Skip to main content
Solved

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

  • December 20, 2022
  • 2 replies
  • 391 views

mferber

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.

Best answer by mferber

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 

 

 

View original
Did this help you find an answer to your question?

2 replies

mferber
  • Author
  • Best Answer
  • December 20, 2022

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 

 

 


nielsgerrits
VIP
Forum|alt.badge.img+53
mferber wrote:

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!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings