I have a FME 2022.1 Desktop workspace with dynamic reader and dynamic writer. The reader generates several lists in some feature classes, in addition to attributes.
How can I parameterize e.g. ListIndexer or ListExploder transformers to treat all appearing lists within various features of various feature classes streaming through my dynamic workspace at once, not explicitly knowing their list names (and hence not being able to indicate them as transformer parameter) ?
Solved
How to treat all appearing lists at once within a dynamic workspace?
Best answer by takashi
Since some codes in my previous script are available only in FME 2024 or later, it doesn’t work in FME 2022.
Try this script instead.
import fme
import fmeobjects
import re
class FirstElementExtractor(object):
def __init__(self):
pass
def input(self, feature):
for attr in feature.getAllAttributeNames():
m = re.match(r'^(.+)\{0\}(\..+)?', attr)
if m:
name = m.group(2)[1:] if m.group(2) else m.group(1)
value = feature.getAttribute(attr)
feature.setAttribute(name, value)
self.pyoutput(feature)
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.