Question

What is the meaning of "Attribute Is Empty" in the Tester?

  • 14 November 2013
  • 9 replies
  • 21 views

Badge
Dear FME community,

 

 

could somebody tell me what the operator "Attribute Is Empty" means in the tester transformer? This might seem fairly clear, but I found out that it isn't (at least not for me ,-)

 

 

If I test an mapinfo (text) attribute value wich contains no text or strings (ie. it is empty), the tester says it's not empty. I have to test it with the operator = for "", then I get the expected result.

 

 

I also encounted this problem in the transformer StringPadder. There exists the option "Pad Empty Attribute". But even if the string is empty, the transformer does not fill/pad it out. Although the StringLengthCalculator gives out a length of zero for the value.

 

 

Perhaps somebody could give me some information. Many thanks

 

 

Kind regards

 

Thomas

9 replies

Userlevel 4
Hi,

 

 

what does the MapInfo value look like if you send it to the Inspector or the Logger?

 

 

If I create an attribute using the AttributeCreator and leave the "Value" column empty, the Tester works as expected with "Attribute is empty": is passes.

 

 

David
Badge
Hi David,

 

 

if a value exists:

 

 

2013-11-14 11:06:12|   0.4|  0.0|INFORM|Attribute(encoded: cp1252)        : `NENNER' has value `1'

 

 

The StringLengthCalculator says:

 

 

2013-11-14 11:06:12|   0.4|  0.0|INFORM|Attribute(encoded: utf-8)         : `_length_NENNER' has value `1'

 

 

#################################

 

If no value exists, the attribute NENNER doesn't exists.

 

 

The StringLengthCalculator says:

 

 

2013-11-14 11:06:12|   0.4|  0.0|INFORM|Attribute(encoded: utf-8)         : `_length_NENNER' has value `0'

 

 

Kind regards

 

Thomas
Userlevel 4
When you say: "If no value exists, the attribute NENNER doesn't exists.", does that refer to a feature where there is no attribute called NENNER at all? If so, you will have to test with "Attribute is null" rather than "Attribute is empty".

 

 

For an attribute to be considered empty, the attribute needs to exist and have an empty string value.

 

 

For an attribute to be considered NULL, it should not exist at all (this will change in FME2014). In other words, removing an attribute is identical to setting it to NULL.

 

 

David

 

 

Userlevel 4
Oh, and note that the StringLengthCalculator will report length = 0 regardless of whether the attribute is empty or doesn't exist at all...

 

 

David
Badge
Thank you for the additional information David.

 

 

In these cases, the attribute NENNER doesn't exists indeed. It's doesen't show up in the inspector too. I didn't know that this would be possible, but obviously it does. The table view in MapInfo GIS suggests that there is "something" there (an attribute, even an empty one), but the FME knows better and tells me that there is nothing.

 

 

If I filter for NENNER is NULL, I get the right result. The attribute doesn't show up in the Feature Information (the right window) in the inspector as expected, but it shows up (with empty values) in the Table View. Even if no values are present in all entries of the attribute.

 

 

Kind regards

 

Thomas
Badge
One more question:

 

 

The test for NENNER = "" (empty string) and NENNER with the operator "Attribute Is Null" gives the same objects. Is this the right result?

 

 

Kind regards

 

Thomas
Userlevel 4
I just tested using FME 2013 SP4 and it does not behave like that. The Tester correctly makes the distinction between an empty string (attribute is empty) and not present (attribute is null).

 

 

That being said, I've always been a proponent of a more standardized NULL handling in FME and I really do look forward to the improvements in FME 2014.

 

 

David
Badge
Yes, looking forward to FME 2014 too. A colleague just tested it with SP4, with the same effect. The test for an empty string and for "Attribute Is Null" reveals the same result.
Badge +3
I find the distinction between empty and Null very usefull in scripts.

 

 

I can make an overlay i.e. between buildings and some parcel and route all features to 1 transformer, avoiding duplicate transformers etc. or just cause i want to do same operations on em.

 

Testing for existence of an attribute then gives a good test to separate the sets when needed.

 

This eliminates lotta clustering or stacking of transformers. I get more flat (horizontal workbenches)

 

 

Also combining 2 tests; attruibute exists OR attribute is empty is very common to me when using complex spatial realtions on multiple sources.

 

 

Of course an attribute showing in a table is pretty logical if it is somehow a join of mutliple tables those. Doesnt mean its actually there.

 

 

removing the distinction would mean i have to adapt some scripts...

 

Reply