7

I am reading around 120 spatial tables in FME. I would like to export a spreadsheet or CSV using FME that contains the feature name (table name) and the number of records in that table.

So far, I've tried linking a counter to each feature type and the Statistics Calculator to get the max value for the counter. I then try to write the CSV with only fme_feature_type and max attributes. I'm getting the max value output okay, but the fme_feature_type is not writing to the CSV.

Any ideas? Also, do I need to add a counter to all the tables separately? Or can I connect them all to a counter and then split it up somehow by fme_feature_type?

3

Try a group by in statistics calculator as fme_feature type, you need to expose the fme feature type from the reader.

  • Yes, in which case the "Total Count" output is what will contain your result. But the Counter method is equally as valid. – Mark Ireland Mar 4 '13 at 16:56
  • I had actually tried this and it was working but not outputting the fme_feature_type, just the count. I tried exposing the attribute but it wasn't working. In the end, I manually added fme_feature_type as a user attribute and it worked, even though I had already added it in the Format Attributes. It's working now and this was the best approach. Thanks. – Fezter Mar 5 '13 at 0:30
3

Not tried this, but it sounds like you should be able to use the Counter transformer and specify your feature_type_name (or fme_feature_type if you haven't renamed it) attribute as the "Counter Name" parameter:

Counter Name

Create separate sequences of numbers to be assigned, either by placing several Counter transformers with each having a different counter name, or by choosing an attribute whose value will be used as the counter name as each feature passes through. (In effect, using an attribute to supply the Counter name is like having a Group By option for the Counter.)

I also found this discussion on FME Community Answers.

  • Remember to check the default start number 0, sometimes you might want it to start at 1 or -2 etc depending on your workspace. – Mapperz Mar 1 '13 at 14:24
  • The default attribute is _count you can use the AttributeRenamer to change that after that transformer. – Mapperz Mar 1 '13 at 14:26
-3

I decided to simply add readers for all the objects I needed a count for and hit run. After it 'runs' the 'Features Read Summary' in the log has all the counts, and I just copied that into a text doc which could easily be converted to a csv.

  • This is fine if you don't have many feature types. However, if you have an unknown number of files. For example, you're reading thousands of shapefiles in a folder and subfolders, this wouldn't work. Even in my example of 120 files, this seems like too many readers. – Fezter Mar 1 '17 at 23:10
  • This solution is OK for testing while building a workbench, but doesn't allow for automation. – Erica Apr 11 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.