Solved

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

  • 11 August 2021
  • 7 replies
  • 12 views

Badge +14

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!

icon

Best answer by virtualcitymatt 11 August 2021, 23:39

View original

7 replies

Userlevel 4
Badge +26

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?

Badge +14

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.

Userlevel 4
Badge +26

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​

Badge +14

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.

Userlevel 6
Badge +32

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

Userlevel 3
Badge +13

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.

Badge +14

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

Reply