Skip to main content
Solved

Expose attributes that match a pattern

  • October 11, 2016
  • 4 replies
  • 32 views

Forum|alt.badge.img+1

Hello,

I have a set of features, which have specific(but varying) attributes that I want to expose. All these attributes are uppercase, but all features do not have these attributes, and the names of the attributes vary quite a lot. The only thing they all have in common is being upperspace. I can filter them out with the PythonCaller, but I am unsure about how to input them to the AttributeExposer.

The only input I can give the AttributeExposer is to open a file and read from there. Seems like a big workaround to read all the attributes, filter them, then write to a file and then open it.

Best answer by david_r

This is somewhat related to https://knowledge.safe.com/questions/30874/expose-format-attributes-with-values-only.html and https://knowledge.safe.com/questions/32483/dynamic-attributes-in-custom-transformer.html.

The short answer is that you can't, really. At least not easily without resorting to tricks.

You could either continue with the PythonCaller (my preferred solution), or consider a solution using the AttributeExploder, which will let you work with features having attribute names that are unknown when you design the workspace. Just be aware that the AttributeExploder route can be quite demanding on memory resources when <number of features> x <number of attributes per feature> gets bigger, but on the other hand you can do everything without having to deal with Python.

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.

4 replies

ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • October 11, 2016

You can expose attributes using a featuremerger (not sure whether this is by accident or design).

If you have a file which has all the attributes you wish to expose, you can merge with the data (using 1 so everything is merged) with the featuremerger settings set to accumuldation mode - merge supplier and conflict resolution - use requestor.


david_r
Celebrity
  • 8392 replies
  • Best Answer
  • October 11, 2016

This is somewhat related to https://knowledge.safe.com/questions/30874/expose-format-attributes-with-values-only.html and https://knowledge.safe.com/questions/32483/dynamic-attributes-in-custom-transformer.html.

The short answer is that you can't, really. At least not easily without resorting to tricks.

You could either continue with the PythonCaller (my preferred solution), or consider a solution using the AttributeExploder, which will let you work with features having attribute names that are unknown when you design the workspace. Just be aware that the AttributeExploder route can be quite demanding on memory resources when <number of features> x <number of attributes per feature> gets bigger, but on the other hand you can do everything without having to deal with Python.


Forum|alt.badge.img+1
  • Author
  • 56 replies
  • October 11, 2016

This is somewhat related to https://knowledge.safe.com/questions/30874/expose-format-attributes-with-values-only.html and https://knowledge.safe.com/questions/32483/dynamic-attributes-in-custom-transformer.html.

The short answer is that you can't, really. At least not easily without resorting to tricks.

You could either continue with the PythonCaller (my preferred solution), or consider a solution using the AttributeExploder, which will let you work with features having attribute names that are unknown when you design the workspace. Just be aware that the AttributeExploder route can be quite demanding on memory resources when <number of features> x <number of attributes per feature> gets bigger, but on the other hand you can do everything without having to deal with Python.

 

Python seems like the way to go, yes. I will have a go at attempting to create a schema from the attributes I've read and applying that to the writer in the end. It's also a bit of a workaround, but would at least produce the end result I desire.

 

 

Thanks for the help!

eduardojsilvajr

You can expose attributes using a featuremerger (not sure whether this is by accident or design).

If you have a file which has all the attributes you wish to expose, you can merge with the data (using 1 so everything is merged) with the featuremerger settings set to accumuldation mode - merge supplier and conflict resolution - use requestor.

I've tried this in FME 2019 and the featuremerger didn't exposed the attributes.