mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
Used named parameters for with_variable function
This commit is contained in:
parent
34bb08c156
commit
89cd7858e5
@ -5,7 +5,7 @@
|
||||
"arguments": [
|
||||
{"arg":"name","description":"the name of the variable to set"},
|
||||
{"arg":"value","description":"the value to set"},
|
||||
{"arg":"node","description":"the expression for which the variable will be available"}
|
||||
{"arg":"expression","description":"the expression for which the variable will be available"}
|
||||
],
|
||||
"examples": [ { "expression":"with_variable('my_sum', 1 + 2 + 3, @my_sum * 2 + @my_sum * 5)", "returns":"42"}]
|
||||
}
|
||||
|
@ -4863,7 +4863,11 @@ bool QgsArrayForeachExpressionFunction::prepare( const QgsExpressionNodeFunction
|
||||
}
|
||||
|
||||
QgsWithVariableExpressionFunction::QgsWithVariableExpressionFunction()
|
||||
: QgsExpressionFunction( QStringLiteral( "with_variable" ), 3, QCoreApplication::tr( "General" ) )
|
||||
: QgsExpressionFunction( QStringLiteral( "with_variable" ), QgsExpressionFunction::ParameterList() <<
|
||||
QgsExpressionFunction::Parameter( QStringLiteral( "name" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "value" ) )
|
||||
<< QgsExpressionFunction::Parameter( QStringLiteral( "expression" ) ),
|
||||
QCoreApplication::tr( "General" ) )
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -1287,7 +1287,7 @@ class TestQgsExpression: public QObject
|
||||
QTest::newRow( "'a' not like 'a%'" ) << QStringLiteral( "'a' not like 'a%'" ) << false << QVariant( 0 );
|
||||
|
||||
// with_variable
|
||||
QTest::newRow( "with_variable('five', 5, @five * 2)" ) << QStringLiteral( "with_variable('five', 5, @five * 2)" ) << false << QVariant( 10 );
|
||||
QTest::newRow( "with_variable(name:='five', value:=5, expression:=@five * 2)" ) << QStringLiteral( "with_variable(name:='five', value:=5, expression:=@five * 2)" ) << false << QVariant( 10 );
|
||||
QTest::newRow( "with_variable('nothing', NULL, COALESCE(@nothing, 'something'))" ) << QStringLiteral( "with_variable('nothing', NULL, COALESCE(@nothing, 'something'))" ) << false << QVariant( "something" );
|
||||
|
||||
// array_first, array_last
|
||||
|
Loading…
x
Reference in New Issue
Block a user