File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ <h3>coalesce() function</h3>
2
+ Returns the first non-NULL value from the expression list.
3
+ <br>
4
+ This function can take any number of arguments.
5
+ <h4>Syntax</h4>
6
+ <code>coalesce(expression1, expression2 ...)</code><br>
7
+
8
+ <h4>Arguments</h4>
9
+ <code>expression</code> - any valid expression or value, irregardless of type.
10
+ <br>
11
+
12
+ <h4>Example</h4>
13
+ <!-- Show example of function.-->
14
+ <code>coalesce(NULL, 2) → 2</code><br>
15
+ <code>coalesce(NULL, 2, 3) → 2</code><br>
16
+ <code>coalesce(7, NULL, 3*2) → 7</code><br><br>
17
+ <code>coalesce("fieldA", "fallbackField", 'ERROR') → value of fieldA if it is non-NULL
18
+ else the value of "fallbackField" or the string 'ERROR' if both are NULL</code><br>
19
+
Original file line number Diff line number Diff line change @@ -92,6 +92,9 @@ TARGET_LINK_LIBRARIES(qgis.g.info
92
92
${GRASS_LIBRARY_gproj}
93
93
${GDAL_LIBRARY}
94
94
)
95
+ IF (UNIX )
96
+ TARGET_LINK_LIBRARIES (qgis.g.info m )
97
+ ENDIF (UNIX )
95
98
96
99
########################################################
97
100
# Install
Original file line number Diff line number Diff line change @@ -295,6 +295,9 @@ class TestQgsExpression: public QObject
295
295
QTest::newRow ( " condition else" ) << " case when 1=0 then 'bad' else 678 end" << false << QVariant ( 678 );
296
296
QTest::newRow ( " condition null" ) << " case when length(123)=0 then 111 end" << false << QVariant ();
297
297
QTest::newRow ( " condition 2 when" ) << " case when 2>3 then 23 when 3>2 then 32 else 0 end" << false << QVariant ( 32 );
298
+ QTest::newRow ( " coalesce null" ) << " coalesce(NULL)" << false << QVariant ( );
299
+ QTest::newRow ( " coalesce mid-null" ) << " coalesce(1, NULL, 3)" << false << QVariant ( 1 );
300
+ QTest::newRow ( " coalesce exp" ) << " coalesce(NULL, 1+1)" << false << QVariant ( 2 );
298
301
299
302
// Datetime functions
300
303
QTest::newRow ( " to date" ) << " todate('2012-06-28')" << false << QVariant ( QDate ( 2012 , 6 , 28 ) );
You can’t perform that action at this time.
0 commit comments