Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
image_expression_null_value_handling [2022/08/20 19:28]
admin
image_expression_null_value_handling [2022/08/20 19:45]
admin
Line 32: Line 32:
 The  null evaluation mechanism allows us to write short expressions like ''​i1 + 10''​ to add 10 to every //valid cell// of the ''​i1''​ map, or ''​i1 * i2''​ to  multiply two maps. If one of the map cells is null, the result is null, so in the last example, we are basically just multiplying the corresponding cells where the  two values are valid: **everything else will be null**. The  null evaluation mechanism allows us to write short expressions like ''​i1 + 10''​ to add 10 to every //valid cell// of the ''​i1''​ map, or ''​i1 * i2''​ to  multiply two maps. If one of the map cells is null, the result is null, so in the last example, we are basically just multiplying the corresponding cells where the  two values are valid: **everything else will be null**.
  
-If we  want to treat all null values as values 1s, in the previous expression, we can write ''​(i1 ? 1) * (i2 ? 1)''​. We can also use the more complicated form using the ''​if then else''​ to achieve the same result:  +If we  want to treat all null values as values 1s, in the previous expression, we can write ''​(i1 ? 1) * (i2 ? 1)''​. We can also use the more complicated form using the ''​if then else''​ to achieve the same result ​such as ''​(if isnull(i1) then 1 else i1) * (if isnull(i2) then 1 else i2)''​, or even
- +
-  ​(if isnull(i1) then 1 else i1) * (if isnull(i2) then 1 else i2), +
- +
-or +
   if isnull(i1) and isnull(i2) then 1   if isnull(i1) and isnull(i2) then 1
   else if not isnull(i1) and not isnull(i2) then i1*i2   else if not isnull(i1) and not isnull(i2) then i1*i2