Skip to main content
I have a workspace set up to read features in a GDB and log the count of the number of features it finds using a combination of StatisticsCalculator + Counter + TestFilter. It logs the correct number of features in an Excel spreadsheet (Writer set to INSERT). Works perfectly to log the GDB name, the feature class name and the count found.

 

But, when there are no features in the feature, how do I log the GDB name, the feature class name and the count of 0? The first transformer, the StatisticsCalculator, is never reached.

 

I was thinking that a Python Shutdown script might be the way to go...? Use arcPy to append an entry to the Excel sheet only if the TotalFeatureWritten == 0...?

 

TIA

 

Brian

 

Hi Brian,

 

 

Assuming that the GDB is File Geodatabase, you can read the schema definition including feature class names from the source dataset(s) using the Schema (Any Format) Reader, even if there are no records.

 

For example, try adding this process to detect feature classes containing no records, after summarising the number of records that exist.

 

 

Just be aware that the attribute name that holds feature class name is "fme_feature_type_name", in the schema features coming from the Schema reader.

 

 

Takashi
Looks like you are using FME 2014, but the StatisticCalculator seems to have been added to the workspace with further older Workbench - FME 2012 or earlier. Isn't it?

 

If my observation is correct, the "Summary" port will appear if you add a new StatisticsCaluclator with FME 2014 Workbench. And, I think you can use the features output from the port, without using the following Counter and TestFilter.
Hi,

 

Thank you both for your insightful responses 🙂 Takashi: good call on the obsolete StatisticsCalculator I was still using from a previous workspace!

 

Hi Dale: I was a bit confused when you said '...and pump it into a statisticscalculator ALONG WITH the actual data..." Well, there isn't any actual data to add ALONG WITH...right? The point of the FMW is to capture the count when they are there AND when they are not.

 

 

Nevertheless, you both put me onto the Schema Reader and I used that in conjunction with a FeatureReader to acheive a correct record count, even if the record count is 0.

 

 

I've also created a WorkSpace Runner FMW that I can point to a folder of GDBs (each of which contain the same target fme_feature_type_name) and it will iterate through all of them and will log the results in the correct sheet in the Excel file.

 


Good to hear you got a workaround.

 

I think Dale's suggestion is this.

 


Reply