Skip to main content

I have a work bench that transforms data from multiple sources and then inserts only the new records from the combined data into a table using a merge transformer and Feature Writer.

For auditing purposes I need to log how many records were written to a table in the same Database as well as pass that info back to FME Server to include in a email via automations. I am able to do this currently with the summary output of the Feature writer, however I would also like to pass the count of the existing records and also set the total written to 0 rather than the undefined that gets returned when there is no new records to add. I've tried using counters but either I'm using them incorrectly or I'm missing some steps as the flow doesn't continue down the path when there are no new records.

 

image

Multiple suggestions:

  • The Counter transformer will give every feature passing an incrementing integer. Feature 1 gets 0, feature 2 gets 1, feature 3 gets 2, etc. What you want is a total number of features passing from the Merged port. This can be done using an Aggregator (set an attribute in the Count Attribute field) or a StatisticsCalculator.
  • I believe you want to have the result of the Aggregator and the FeatureWriter in a single line. Current setup will result in two different lines. 2 different emails from your automation. So merge the Aggregator output to the FeatureWriter output. This can be done again with an Aggregator.
  • The NoFeaturesTester is a transformer that will fire a feature when no features are found. This can be used to do what you need when no features arrive.

Reply