Skip to main content
Question

Is it possible to create attributes from values and use them without having to manually expose them?

  • November 13, 2020
  • 2 replies
  • 18 views

Forum|alt.badge.img

I have a table and I want to build another table from it, e. g.

values | types
12     | house
3      | car
4      | boat

to:

house | car | boat
12    | 3   |  4

This works with the AttributeCreator (Input: @Value(types) / values), if you check the output with a Logger. However I can't see or use the result in other transformers, unless I expose the fields with the AttributeExposer, which defeats the purpose of the dynamic creation. Is there any way around that? The content of the table changes, so exposing manually is not exactly desirable. There's a custom transformer, AttributeTransposer, but it also requires exposing afterwards.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, 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.

2 replies

ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • November 13, 2020

You can't expose them on the workspace canvas, but it's not necessary to expose them in order to write them out to a new format.

Do you need them exposed on the canvas? Because if they need to be exposed on the canvas and then you explicitly reference them the workspace is no longer dynamic.

 

You can do some manipulation in a python caller without exposing


david_r
Celebrity
  • 8392 replies
  • November 13, 2020

If you're looking to process some attributes without necessarily knowing the exact name, you can use the AttributeExploder. It will return one feature per attribute / value pair of each feature that enters. It's not super efficient however, since feature creation is relatively costly.

The most efficient solution is to use Python, is my experience, as you can loop over feature attributes without creating FME features on the way.

But as @ebygomm​ stated, if you're just looking to write out the attributes to a dynamic writer, it's not necessary to expose the attributes at all.