Question

Filtering null values with Filter Features tool in FME Universal Viewer

  • 29 November 2012
  • 2 replies
  • 12 views

Hi Gurus, this one has me stumped.

 

 

I have a shapefile with a few thousand features in it and a few dozen fields.  One of these fields in the majority of cases has nothing in it, but in a few cases has non-null data - an URL string.  These are the ones I am interested in looking at.

 

 

A google scouring turned up only three references total to the Viewer tool at all (two fme KB links, and a Google group post), none of which apply to this question.

 

 

I can specify $Fieldname and operator '!=' but what do I put in the right hand side of the  tool to specify null values?  I am assuming that the value is actually null or some kind of empty value, and not whitespace, invisible ASCII or some other junk...

 

 

I've tried 'null', '' and "" , and each time it filters nothing at all.

 

e.g.:

 

Restoring 21330 feature(s) from FME feature store file `d:\\temp\\FFS_1354146331484_5808' SHAPE::Testing: &History != ""(TestFactory): Tested 11109 input feature(s) -- 11109 feature(s) passed and 0 feature(s) failed

 

If I try to leave it 'empty' I get "Invalid or unspecified left side or right side of test expression"

 

Yes, I could use Workbench with a Tester or NullAttributeReplacer, convert it to a database table and use SQL, or open the data in ArcMap, but I would have thought FME Viewer would be able to do the same simle operation, faster.

 

 

I have had some luck with using "&Fieldname > X" (X can be zero or larger)  which appears to be equivalent to "LENGTH(&fieldname) > 0", even though this is directly opposite to what the documentation says about how this works.

 

 

 I'm sure most GIS users deal with null values in their data all the time, so this should be simple, but I don't see what I need to do in this case. 

 

 

Any advice appreciated.

 

 

Regards,

 

Andrew Quee.

2 replies

Badge +14
The tester should have worked.  Can you send a sample set of your data?  That would give me a better idea of what is going on with the particular field.
In reply to WiseGIS, as I mentioned, I could have created a workbench with a Tester, but that seemed a bit of overkill, considering there's a filter tool right there in the Universal Viewer.

 

 

Anyway, I was preparing a data extract for you in shapefile format with some null and non-null field values and thought I would give Viewer one more shot.  To my surprise &Fieldname != ""  (that's two double quotes, or an empty string) worked okay on the extract!

 

 

Adding more data didn't provoke the filter error and so I decided to export the entire dataset to ESRI gdb (file geodatabase) to see if it was an issue with the container, not the data or the application.

 

 

Low and behold, when I used the filter features tool to show only features with a non-empty  field value, it worked!

 

 

Shapefiles strike again.  I can see why the industry is trying to leave these behind.

Reply