Question

Hi. I am using FME workbench 2022.2, made a custom transformer and want to automate to run multi times in a script depending on the number of differences in valeu of an attribute (this may varies).


I plan to use this method after a transformer "AttributeFilter".

So the the number of cases the valeu of an ttribute varies define the repetition number the transformer .

 


11 replies

Userlevel 5
Badge +29

I'm gathering you're essentially wanting find all unique values in a dataset and pass each unique value into the transformer?

 

You could either use the duplicate filter or sampler (with groupby set to the attribute name and "first n features" selected.

 

Both of these approaches will give you one feature for each different value in the select attribute

Badge

I'm gathering you're essentially wanting find all unique values in a dataset and pass each unique value into the transformer?

 

You could either use the duplicate filter or sampler (with groupby set to the attribute name and "first n features" selected.

 

Both of these approaches will give you one feature for each different value in the select attribute

Yes excacly.

Badge

I'm gathering you're essentially wanting find all unique values in a dataset and pass each unique value into the transformer?

 

You could either use the duplicate filter or sampler (with groupby set to the attribute name and "first n features" selected.

 

Both of these approaches will give you one feature for each different value in the select attribute

Thanks for the hint. Will try your sugestion.

Badge

Hi hkingsbury,

From an xlsx file with thousand records I need to filter by one attribute, in this case the "ID-CODE".

Using transformer "ATTRIBUTE FILTER" I can redirect each record to a deferent outport, depending on the "ID-CODE" attribute valeu. The costum transfomer must proces all the records passing through each outport separatly.

So the records passing through the 1st outport has to be processed by the costum transformer, then the records passing through the 2nd outport and so on till all the outports are processed without using copy and paste. The costum transformer has to be recalled for each outport.

Hope I could make the case clearer.

 

Badge

Hi here a screenshot of the script using copy and paste.

Badge

Screenshot of the script.

Userlevel 4
Badge +36

Out of curiosity: why do you need to use a different instance of your custom transformer for each "ID-CODE"? Although I don't know the contents of your custom transformer, it looks like this may not be necessary.

Out of curiosity: why do you need to use a different instance of your custom transformer for each "ID-CODE"? Although I don't know the contents of your custom transformer, it looks like this may not be necessary.

Hi geomancer, thanks for replying.

As you noticed each record has an unique "ID-CODE". Each records has many more attributes which I will aggregate together for further use (relate 1 to 1).

The aggregation has to be performed for each 'ID-CODE" resulting in 1 record for each. By using the custom transformer once all the records will be aggregated in one record. Hope I could make it clearer.

Userlevel 4
Badge +36

Out of curiosity: why do you need to use a different instance of your custom transformer for each "ID-CODE"? Although I don't know the contents of your custom transformer, it looks like this may not be necessary.

I still expect you don't need a custom transformer.

If every "ID-CODE" exists only once, you can just process every record individually (FME does this by default).

In the case an "ID-CODE" exists serveral times, and you want to aggregrate all records with the same "ID-CODE", you can usually use a ListBuilder, setting 'Group By' to "ID-CODE", create a list of the attributes of the original records with the same "ID-CODE", and perform the aggregation on the attributes in the list.

This will also make your workspace more versatile and more robust, as you can process future data sets without having to set all unique values for "ID-CODE" explicitly in your workspace.

Hi geomancer, thanks again for replying.

 

Your last reply was very helpfull. I put in use a "ListBuilder" as you sugested with Group By set to "ID-CODE" and could work out the script wich is now performing perfectly. Many thanks for the hint. I was overlooking the "ListBuilder" capabilities.

Userlevel 4
Badge +36

You're welcome :)

Reply