Skip to main content

Hi,

My current FME workbench uses an AttributeFilter to create separate output ports for distinct attribute values. Each of these output ports then connect to the same 'series of transformers'.

Base on the input file that is passed to the Reader, the name and count of the attribute values is bound to change and I would import the attribute values in AttributeFilter everytime to take care of this change and then add or delete the 'series of transformers' according to the output ports of the AttributeFilter.

In order to find an automated way to the above, I know I have to somehow loop through each of the Attribute values and pass it to the series of transformers repeatedly. The first thing I did is to create a custom transformer that takes care of the series of transformers and have also added a loop to it.

Can someone suggest what could be the way that the attribute values could be fed to the custom transformer and also tell the workbench when to stop.

Thank you !

(Can python help ?)

Since the "series of transformers" remains the same I'm wondering whether you could achieve this by using a Group By. If you expose that parameter as a parameter of your custom transformer it'll most likely be sorted out without having to resort to python.

Any chance you can share your workspace? That'll make it easier to give some specific advice.


I'm with @redgeographics on this one. I don't think you need to use a loop. You can use a group-by and then FME is responsible for handling any 'loops' that occur. In the custom transformer look in the transformer parameters (Navigator window). Set Parallel Processing to Minimal and then you get a Parallel Process By parameter. Select your attribute in there and you should be good to go. You'll get parallel processes you don't perhaps need, but the important thing is that each attribute value is handled separately.


It depends on the process that's needed repeated. That is what type of transformers are used etc..

It is not clear if a Group By strategy is an option.

(like can you somehow Tile or spatialy relate all requirements, or do all requiremenst share some common attribute(value) etc.)

If not then you could do following.

Use statisticscalculator to count total number of values of the relevant attribute.

Set a counter on it", like "attrValue_count".

Clone sets of data to process by the amount of attrValue_count, wich you can do by unconditionaly relating the "Total_attrValue_count" to required data for processing and then using value in Cloner.

Create index.

Then feed to a custom loop where u have a counter, tester and index incrementer to check wheter it reaches the number of attribute values counted.

Test index = "attrValue_count", if yes send passed trough the process.

Send failed to tester.

Test for index <

"Total_attrValue_count". Failed: no output needed.

Passed: to loop.

(If u wanted to create a multi-spatialrelator or multi-clipper for instance , you would need to do so. Where a object is clipped by different clippers independently.

something fme even in version 2015 has qualms with btw...lol)

Have not tested them in 2016 version yet.


It depends on the process that's needed repeated. That is what type of transformers are used etc..

It is not clear if a Group By strategy is an option.

(like can you somehow Tile or spatialy relate all requirements, or do all requiremenst share some common attribute(value) etc.)

If not then you could do following.

Use statisticscalculator to count total number of values of the relevant attribute.

Set a counter on it", like "attrValue_count".

Clone sets of data to process by the amount of attrValue_count, wich you can do by unconditionaly relating the "Total_attrValue_count" to required data for processing and then using value in Cloner.

Create index.

Then feed to a custom loop where u have a counter, tester and index incrementer to check wheter it reaches the number of attribute values counted.

Test index = "attrValue_count", if yes send passed trough the process.

Send failed to tester.

Test for index <

"Total_attrValue_count". Failed: no output needed.

Passed: to loop.

(If u wanted to create a multi-spatialrelator or multi-clipper for instance , you would need to do so. Where a object is clipped by different clippers independently.

something fme even in version 2015 has qualms with btw...lol)

Have not tested them in 2016 version yet.

Thank you @gio

 


I'm with @redgeographics on this one. I don't think you need to use a loop. You can use a group-by and then FME is responsible for handling any 'loops' that occur. In the custom transformer look in the transformer parameters (Navigator window). Set Parallel Processing to Minimal and then you get a Parallel Process By parameter. Select your attribute in there and you should be good to go. You'll get parallel processes you don't perhaps need, but the important thing is that each attribute value is handled separately.

Thank you @Mark2AtSafe. This was my first custom transfomer and your advice was a good eye opener. That worked perfect for me ! Thanks.

 


Since the "series of transformers" remains the same I'm wondering whether you could achieve this by using a Group By. If you expose that parameter as a parameter of your custom transformer it'll most likely be sorted out without having to resort to python.

Any chance you can share your workspace? That'll make it easier to give some specific advice.

Thank you @redgeographics :)

 


Reply