Question

Dynamically expose all attributes in an embedded custom transformer ?

  • 26 March 2020
  • 3 replies
  • 30 views

Userlevel 1
Badge +22

Hi list.

This question has been touched on multiple times, but in different setups, so I'll ask it anyway.

I have 16 datasets, that need to run thru the same set of 4 regular transformers. Each dataset has a varying set of attributes.

I would like to create a single embedded custom transformer with these 4 regular transformers, and reuse the embedded transformer instead of having to add 4x16 (=64) similar transformers.

The attributes are to be accessed in the contained regular transformers, creating a need to expose the attributes.

Is this even doable in any sensible way ?

Cheers


3 replies

Userlevel 1
Badge +21

I don't think it is, but I'm interested if someone says it's possible. I had a similar requirement where I wanted to select x amount of attributes to be handled in the transformer, with the output being the same attributes as selected but with a suffix. So if attribute1 and attribute2 are selected the output attributes are attribute1_result and attribute2_result.

Badge +8

Hi, @lifalin2016, @ebygomm, I'm not sure what you're trying to do exactly. Can you share an example? What kind of transformers do you want to use as the 4 regular transformers?

Badge +8

Hi, I tried a setup using the following approach:

  1. You can read all data using a reader in dynamic mode
  2. Extract the geometry of the feature into a hex encode FME Binary
  3. Fanout all features into Attribute/Values pairs using an AttributeExploder.
  4. Now you can use a SchemaMapper to rename, copy, filter, or do whatever you want to do on any attribute you like.
  5. To get back, use a StringConcatenator and Aggreator, creating a JSON string
  6. Use JSONFlattener to get back the original features and decode the generated geometry hex

See the accompanying workspace.UsingJSONto_De_SerializeAttributes.fmw

Reply