Skip to main content

How do I read the number of records produced from a transformer and use that number in a Cloner Transformer (not directly connected)?

I can grab the number via the Statistics Transformer. However I cannot set the number in the Cloner. Ideally I would add the number as an attribute for all records (in the data going into the Cloner). However I cannot work out how to do this.

Note that I am dealing with 2 completely different sets of data here. The first has the record count. The other data set I want to clone based on the firsts record count.

Thanks for any help I can get.

Hi @jiphoc, save the number of features from the first dataset as a global variable using the VariableSetter, and then give the number to the features from the second dataset as a new attribute using the VariableRetriever.

Note that FME has to read the first dataset before the second dataset. Make sure that the reader for the first dataset is located upper than the second reader in the Navigator window.


Hi @jiphoc, save the number of features from the first dataset as a global variable using the VariableSetter, and then give the number to the features from the second dataset as a new attribute using the VariableRetriever.

Note that FME has to read the first dataset before the second dataset. Make sure that the reader for the first dataset is located upper than the second reader in the Navigator window.

Alternatively you can use the FeatureMerger to merge the number of records (an attribute of the feature from the Summary port of the StatisticsCalculator) to every feature from the second dataset unconditionally. If you set an identical constant (e.g. 1) to the "Join On" parameter for both Requestor and Supplier, attributes of the supplier feature will be merged to every requestor feature unconditionally.


Champion Takashi,

I way playing around with the Variable Setter/ Retriever. I suspect, as you mentioned, the correct data being ready first may be causing me problems. I just figured a purpose built built tool existed and wanted to find it before going back to that method.


I would use a FeatureMerger as Takashi suggested in his comment. Variables are OK in their place, but can be tough to handle. The FeatureMerger is a better solution I think. Then just set the number of cloned features to the attribute just merged in.


Reply