Skip to main content

I'm building quite a lot of flows where the amount of input features should always be the same as the amount of output features. During the processing of the data a lot of transformers merge, delete, split, and aggregate the data but in the end it should always result in the same amount of features as i started.

I now use an UniqueValueLogger to list all the ID's in between and then compare it and at the end i do a manual check to see if the correct amount of features are written to the writer. But i was wondering if this could be tested with the tester and if it does not match can stop the translation raising an error that the input data is not correctly formatted.

Hi @jdh009

Did you already take a look at the FeatureWriter for writing your data? It provides some statistics (e.g. the amount of features written) that might be useful. For more information, click here:

https://docs.safe.com/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Transformers/featurewriter.htm


The FeatureWriter + SQLExecutor is a good option to verify.

I also use a technique in which I parse the workspace log and compare the features read and written.

Hope this helps.


Agree that the FeatureWriter is a good way to get the number of written features.

Another thought. If you want to test the number of features to be written BEFORE writing them into the destination dataset, you can use two global variables which count the number of features passed through the link before/after the translation, like this. Note that a FeatureHolder is used here to save the final count numbers into the variables.

Python global variables can also be used, with two PythonCallers.


What about this way:

Make an custom transformer from

  • an inlinequerier with a simple "select count(*) from table"
  • and a tester on the result: @Value(count(*))!=valuetotest

valuetotest might be a global variable

???


Reply