Skip to main content

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.

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.


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 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!

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.


Reply