Skip to main content
Question

How to change values of a dynamic set of attributes?

  • February 18, 2025
  • 1 reply
  • 52 views

dsignworld
Participant
Forum|alt.badge.img+1

I want to use the StringReplacer to edit a couple of attributes, but their names are not known in advance. Can I save a list of attribute names in an attribute and tell the StringReplacer to work on these attributes?

1 reply

nielsgerrits
VIP
Forum|alt.badge.img+61

If you know the list of attributes before runtime, use a Parameter as input in the StringReplacer.

If the attributes to be StringReplaced are defined during the run, I think I would try to fix this using Python. This is probably the easiest and best performing alternative.

If you want a pure FME solution, you could explode the attributes to features (AttributeExploder), do the selection of attributes based on _attr_name and the string replacement on _attr_value. Then recreate the attributes using an AttributeCreator using @Value(_attr_name), _attr_value. Then merge the attributes back to single records using an Aggregator. But exploding attributes to features can be expensive.