Question

How to design a customised loop transformer?


I am trying to solve the application allocation issue through FME. The scenario is I have a list of applications and a list of places with limited spaces.

 

My initial thought is to sort applications by date, every time, send only one application to the neighbour finder and then change the place's available spaces.

 

The issue that annoys me is it seems like two loops running parallel but also linked together. Not sure what's the best way to design this type of loop?

 

BeforeMy loop design seems like just creating an endless circle.

LoopAny guide would be much appreciated.


5 replies

Userlevel 3
Badge +33

You may want to rethink the flow of the data.

When do you want to exit the loop? Certainly when there are no more places with spaces higher than 0. And when where are no more applications to be sampled. A custom transformer like the NoFeaturesTester or the FeatureDetector may help you out here.

You also may want to check for situations where no changes are made to the data.

 

Userlevel 3
Badge +33

Maybe this part of the documentation will be of help: https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_Desktop/Workbench/transformers_custom_about.htm (especially the part about looping)

You may want to rethink the flow of the data.

When do you want to exit the loop? Certainly when there are no more places with spaces higher than 0. And when where are no more applications to be sampled. A custom transformer like the NoFeaturesTester or the FeatureDetector may help you out here.

You also may want to check for situations where no changes are made to the data.

 

Thank you. I'll have a look at those two transformers. The thing that confuses me is whenever an application is processed; it should also update the available spaces from each location. Then the next application should use the updated location data. How to make the second loop work? Using FeatureJoiner or FeatureMerger will create blocks, then the customised transformer needs to export as a link, and it only supports one loop.

Userlevel 3
Badge +33

You may want to rethink the flow of the data.

When do you want to exit the loop? Certainly when there are no more places with spaces higher than 0. And when where are no more applications to be sampled. A custom transformer like the NoFeaturesTester or the FeatureDetector may help you out here.

You also may want to check for situations where no changes are made to the data.

 

EDIT: Ouch, Sorter and NeighborFinder are blocking transformers as well...

 

Do you really need a FeatureJoiner or a FeatureMerger? The Unmatched Candidates port of the NeighborFiner passes all unused candidates, and the NeighborFinder will add all attributes from the used candidate to the base feature passing the Matched Base port.

Or maybe I just don't understand your workflow. A simple workspace with some sample data (and the desired outcome) makes it much easier to help you in your search.

EDIT: Ouch, Sorter and NeighborFinder are blocking transformers as well...

 

Do you really need a FeatureJoiner or a FeatureMerger? The Unmatched Candidates port of the NeighborFiner passes all unused candidates, and the NeighborFinder will add all attributes from the used candidate to the base feature passing the Matched Base port.

Or maybe I just don't understand your workflow. A simple workspace with some sample data (and the desired outcome) makes it much easier to help you in your search.

Yeah....

See the attached file for sample data and workspaces.

After redoing the process, I noticed that the place update process is not a "loop" as there's no way to exit. It should only run when the "application assigning process" runs. Not sure if FME can process data this way.

 

image

Reply