Skip to main content
Solved

How to Log Feature count == 0 to Excel?


blueinc
Contributor
Forum|alt.badge.img+6
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

 

Best answer by blueinc

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.

 

View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • May 22, 2015
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

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • May 22, 2015
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.

blueinc
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • Best Answer
  • May 25, 2015
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.

 


takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • May 26, 2015
Good to hear you got a workaround.

 

I think Dale's suggestion is this.

 


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