How is it possible to search nested lists in FME? By nested list, I mean that list that is returned from SpatialRelator and contains pass criterias.
How is it possible to search nested lists in FME? By nested list, I mean that list that is returned from SpatialRelator and contains pass criterias.
Best answer by jdh
If you want to do complex list manipulation without exploding into multiple features, then python is a good choice.
If you just want to know if _relationships{}.pass{} contains a specific value than something like the following should work:
def processFeature(feature):
ct = feature.getAttribute('_related_candidates')
value = feature.getAttribute('_criteria')
i = 0
while i <2:
p = feature.getAttribute('_relationships{'+str(i)+'}.pass{}')
i+=1
if value in p:
feature.setAttribute('_found', 'Yes')
else:
feature.setAttribute('_found', 'No')
where _criteria contains the value your looking for.
The trick with lists and python is you can retrieve a list, but not a matrix, so you can't simply get _relationships{}.pass{} but you can retrierve _relationships{0}.pass{} or _relationships{}.pass{0} so with nested lists you need to to wrap the getAttribute in a loop
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.