My question is how to test each element in one list with each element in another list? I have lot of lines segments and using lengthCalculator to find all segments less than some specific length. Further with help of TopologyBuilder I get 'to_node' attribute related to LINE output port and 'node_number' related to NODE output port. I have to detect all dangles. So I am trying to test if there is a "node_number =! to_node" If so, then I know at this segment is dangle. Agree? for this I used transform Tester again, but this is not working. My next idea is to create list of all nodes and another list of all segments < specific_length, and then check (test) each node element in one list with to_node element in teh second list. Will this work? Not good idea? This question is linked to: Find dangling lines . Tnx
-
Use the Tester Transformer or Multiple Testers after the Length Calculator to find line segments length (less than or greater than). fmepedia.safe.com/articles/Samples_and_Demos/…– Mapperz ♦Commented Jun 13, 2012 at 13:16
-
I know that. But it does not help.– Z77Commented Jun 13, 2012 at 15:31
1 Answer
My first thought is to create a custom transformer with a loop in it.
Create an attribute (x) to act as a loop counter. Use the ListIndexer with that attribute to extract the values of the list for entry number x. Then compare them to the actual values with the Tester.
You'll want to make sure you don't overwrite the actual attributes by giving them different names to the ones you fetch from the list.
A ListElementCounter will tell you how many entries there are in the list, so you can increment X and test if it is equal to the list count. If so, that's when you exit the transformer.
Surprisingly (because it is a common operation) I can't find an example of this online; but you can read more about custom transformer loops on FMEpedia.