Skip to main content
Solved

How can I expose attributes based on a comma delimited attribute with field names?


runneals
Contributor
Forum|alt.badge.img+22

I'm making a custom transformer and the users will select multiple choices from a published parameter list that contains a value with text that includes a parsable field name with other info. I've been working to parse that out into a comma delimited attribute, which I now have. In my reading of other questions surrounding this, it seems like this is not possible with truly dynamic transformers/workspaces, but in my case I have a known list of the names. What is the best way to expose attributes that are known in this way in a custom transformer or in general?

Thanks!

Best answer by virtualcitymatt

runneals wrote:

I have like 100+ attributes that I would need to expose if I exposed them all. I suppose the attributes could be exposed just at the output port of the transformer as I don't really need to do anything except get them added to the record that is coming through the transformer.

Well, exposing an attribute is something that can never be done at at runtime. You can create the attribute but you can't expose it.

One option could be to create a Schema Feautre coming out of a separate port​ in the same way the FeatureReader works.

That way at least users can use it when writing.

​The easier option would be to just create them and not expose them. The exposing would be up to the user, this isn't uncommon with many FME transformers, e.g., the JSON Flattner.

There might be a way to do what you want but I can't see how it would work.​

I'm definitely keen to see if you manage to get it working​

View original
Did this help you find an answer to your question?

7 replies

virtualcitymatt
Celebrity
Forum|alt.badge.img+35

I think you will just have to expose them all. ​Whats the reason you need them exposed? Are you using them inside the custom transformer or rather want them to be exposed in the output port?


runneals
Contributor
Forum|alt.badge.img+22
  • Author
  • Contributor
  • August 11, 2021
virtualcitymatt wrote:

I think you will just have to expose them all. ​Whats the reason you need them exposed? Are you using them inside the custom transformer or rather want them to be exposed in the output port?

I have like 100+ attributes that I would need to expose if I exposed them all. I suppose the attributes could be exposed just at the output port of the transformer as I don't really need to do anything except get them added to the record that is coming through the transformer.


virtualcitymatt
Celebrity
Forum|alt.badge.img+35
  • Celebrity
  • Best Answer
  • August 11, 2021
runneals wrote:

I have like 100+ attributes that I would need to expose if I exposed them all. I suppose the attributes could be exposed just at the output port of the transformer as I don't really need to do anything except get them added to the record that is coming through the transformer.

Well, exposing an attribute is something that can never be done at at runtime. You can create the attribute but you can't expose it.

One option could be to create a Schema Feautre coming out of a separate port​ in the same way the FeatureReader works.

That way at least users can use it when writing.

​The easier option would be to just create them and not expose them. The exposing would be up to the user, this isn't uncommon with many FME transformers, e.g., the JSON Flattner.

There might be a way to do what you want but I can't see how it would work.​

I'm definitely keen to see if you manage to get it working​


runneals
Contributor
Forum|alt.badge.img+22
  • Author
  • Contributor
  • August 11, 2021
runneals wrote:

I have like 100+ attributes that I would need to expose if I exposed them all. I suppose the attributes could be exposed just at the output port of the transformer as I don't really need to do anything except get them added to the record that is coming through the transformer.

Yeah, I guess I'm running into the same issue that I've been reading about. Guess I'll make the end users do it. I finally created the idea to allow run-time attribute exposing.


nielsgerrits
VIP
Forum|alt.badge.img+54

Can you use a parameter and put this parameter in the "Attributes to Expose" field in the FeatureReader? Like in this topic.


kailinatsafe
Safer
Forum|alt.badge.img+21

Hello @runneals​ , thanks for creating that idea! I am a bit curious to know why you're looking to expose the attributes like this? Perhaps knowing what the scenario or use case is would help motivate the idea! Best, Kailin.


runneals
Contributor
Forum|alt.badge.img+22
  • Author
  • Contributor
  • August 13, 2021
kailinatsafe wrote:

Hello @runneals​ , thanks for creating that idea! I am a bit curious to know why you're looking to expose the attributes like this? Perhaps knowing what the scenario or use case is would help motivate the idea! Best, Kailin.

Hi Kailin,

I was trying to build a semi-dynamic transformer where the user would select multiple layers they wanted to query against (as a published parameter choice list) and then expose the attributes from their selection (which I can parse into a comma delimited list).


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings