Skip to main content
Question

Unexpected Behaviour: Null Treated as a Number in TestFilter


ecx
Contributor
Forum|alt.badge.img+4
  • Contributor

I recently discovered that when using a TestFilter in FME, Null values are treated as numbers, seemingly to behave like negative infinity

If someone is not aware of this (such as myself) this leads to incorrect output data. 

My expectation was that Null should be routed to the 'Unfiltered' port, rather than being processed as a valid numerical value. It is not even treated as zero, as it is in other applications/programming languages, which would at least have some logic to it. 


I am of the opinion that this issue has impacted MANY of your users who were unaware of this.
If there are default options which can be set somewhere to change this functionality, the default should be to rout the null values to the unfiltered port.

try it out for yourself:

 

2 replies

takashi
Influencer
  • April 11, 2025

Hi ​@ecx ,

I think it's an intentional behavior. The help document of Tester says:

When doing comparisons, null, missing, and empty string values, all evaluate to empty string. Thus, they are considered equal in the context of the comparison operators. Further, the following comparison ordering is respected:

  • Null, missing, empty string < other values

https://docs.safe.com/fme/html/FME-Form-Documentation/FME-Transformers/Transformers/tester.htm

If you need to detect <null> with Tester or TestFilter, consider using other operator such as “Attribute Has a Vaue”, “Attribute is Null”.


ecx
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • April 11, 2025
takashi wrote:

Hi ​@ecx ,

I think it's an intentional behavior. The help document of Tester says:

When doing comparisons, null, missing, and empty string values, all evaluate to empty string. Thus, they are considered equal in the context of the comparison operators. Further, the following comparison ordering is respected:

  • Null, missing, empty string < other values

https://docs.safe.com/fme/html/FME-Form-Documentation/FME-Transformers/Transformers/tester.htm

If you need to detect <null> with Tester or TestFilter, consider using other operator such as “Attribute Has a Vaue”, “Attribute is Null”.



Thanks! That’s good to know. But regardless it is not intuitive and filtering out nulls to the unfiltered port should be the default rout. I am absolutely certain that other people who use FME have encountered the same issue as myself which resulted in unexpected test filter output. 

In the majority of other programming languages I’ve used, minus javascript, testing something such as Null < 100, would result in a error, as null is usually not comparable, or is equivalent to zero. 


Reply


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