@@ -888,6 +888,23 @@ static QVariant fcnAggregateStringConcat( const QVariantList &values, const QgsE
888
888
return fcnAggregateGeneric ( QgsAggregateCalculator::StringConcatenate, values, parameters, context, parent );
889
889
}
890
890
891
+ static QVariant fcnAggregateStringConcatUnique ( const QVariantList &values, const QgsExpressionContext *context, QgsExpression *parent, const QgsExpressionNodeFunction * )
892
+ {
893
+ QgsAggregateCalculator::AggregateParameters parameters;
894
+
895
+ // fourth node is concatenator
896
+ if ( values.count () > 3 )
897
+ {
898
+ QgsExpressionNode *node = QgsExpressionUtils::getNode ( values.at ( 3 ), parent );
899
+ ENSURE_NO_EVAL_ERROR;
900
+ QVariant value = node->eval ( parent, context );
901
+ ENSURE_NO_EVAL_ERROR;
902
+ parameters.delimiter = value.toString ();
903
+ }
904
+
905
+ return fcnAggregateGeneric ( QgsAggregateCalculator::StringConcatenateUnique, values, parameters, context, parent );
906
+ }
907
+
891
908
static QVariant fcnAggregateArray ( const QVariantList &values, const QgsExpressionContext *context, QgsExpression *parent, const QgsExpressionNodeFunction * )
892
909
{
893
910
return fcnAggregateGeneric ( QgsAggregateCalculator::ArrayAggregate, values, QgsAggregateCalculator::AggregateParameters (), context, parent );
@@ -4909,6 +4926,7 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions()
4909
4926
<< new QgsStaticExpressionFunction ( QStringLiteral ( " max_length" ), aggParams, fcnAggregateMaxLength, QStringLiteral ( " Aggregates" ), QString (), false , QSet<QString>(), true )
4910
4927
<< new QgsStaticExpressionFunction ( QStringLiteral ( " collect" ), aggParams, fcnAggregateCollectGeometry, QStringLiteral ( " Aggregates" ), QString (), false , QSet<QString>(), true )
4911
4928
<< new QgsStaticExpressionFunction ( QStringLiteral ( " concatenate" ), aggParams << QgsExpressionFunction::Parameter ( QStringLiteral ( " concatenator" ), true ), fcnAggregateStringConcat, QStringLiteral ( " Aggregates" ), QString (), false , QSet<QString>(), true )
4929
+ << new QgsStaticExpressionFunction ( QStringLiteral ( " concatenate_unique" ), aggParams << QgsExpressionFunction::Parameter ( QStringLiteral ( " concatenator" ), true ), fcnAggregateStringConcatUnique, QStringLiteral ( " Aggregates" ), QString (), false , QSet<QString>(), true )
4912
4930
<< new QgsStaticExpressionFunction ( QStringLiteral ( " array_agg" ), aggParams, fcnAggregateArray, QStringLiteral ( " Aggregates" ), QString (), false , QSet<QString>(), true )
4913
4931
4914
4932
<< new QgsStaticExpressionFunction ( QStringLiteral ( " regexp_match" ), QgsExpressionFunction::ParameterList () << QgsExpressionFunction::Parameter ( QStringLiteral ( " string" ) ) << QgsExpressionFunction::Parameter ( QStringLiteral ( " regex" ) ), fcnRegexpMatch, QStringList () << QStringLiteral ( " Conditionals" ) << QStringLiteral ( " String" ) )
0 commit comments