Solved

How to handle NULL values in numeric expressions as 0 using the attribute manager

  • 20 December 2022
  • 2 replies
  • 37 views

I stumbled across the following challenge in FME:

how to deal with NULL values if you want to perform a calculation for a new attribute. For example, I want to sum up values (could be any other kind of arithmetics).

The expected result is fine as long as no NULL Value is involved. FME turns any calculation into a NULL result if any NULL is involved (see documentation).

 

 2022-12-20 16_58_50-Transparent Window 

The question that haunts me is, how to treat those NULL values as 0 in the calculation without changing the value to an actual 0 (as the NullAttributeMapper would). The result I am looking for is the following: If all values are NULL i want the result to be NULL, otherwise I want the NULL value to be treated as 0. Furthermore, I dont want the NULL values to be changed to 0, so I can distinguish between NULL and 0 in further calculations.

icon

Best answer by mferber 20 December 2022, 17:25

View original

2 replies

The AttributeManager has a functionality to handle NULL as 0 (or any other value you like), without tampering with the orignal values.

 

2022-12-20 17_06_53-Window 

can be combined with a condition to preserve NULL for further calculation2022-12-20 17_24_50-Window 

 

 

Userlevel 6
Badge +31

The AttributeManager has a functionality to handle NULL as 0 (or any other value you like), without tampering with the orignal values.

 

2022-12-20 17_06_53-Window 

can be combined with a condition to preserve NULL for further calculation2022-12-20 17_24_50-Window 

 

 

Thanks, learned something new today!

Reply