Skip to main content
Solved

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

  • August 11, 2021
  • 7 replies
  • 136 views

runneals
Supporter
Forum|alt.badge.img+27

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

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​

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.

7 replies

virtualcitymatt
Celebrity
Forum|alt.badge.img+47
  • Celebrity
  • 2000 replies
  • August 11, 2021

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
Supporter
Forum|alt.badge.img+27
  • Author
  • Supporter
  • 321 replies
  • August 11, 2021

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+47
  • Celebrity
  • 2000 replies
  • Best Answer
  • August 11, 2021

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
Supporter
Forum|alt.badge.img+27
  • Author
  • Supporter
  • 321 replies
  • August 11, 2021

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+60
  • 2938 replies
  • August 13, 2021

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+23
  • Safer
  • 720 replies
  • August 13, 2021

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
Supporter
Forum|alt.badge.img+27
  • Author
  • Supporter
  • 321 replies
  • August 13, 2021

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).