Skip to main content
Question

Add parameter as prefix to selected attributes in custom transformer

  • September 11, 2016
  • 5 replies
  • 16 views

bo
Contributor
Forum|alt.badge.img+10
  • Contributor

In a custom transformer, I tried to use BulkAttributeRenamer to add one of the parameters as prefix to a selected set of attributes, see attached image. But it does not seem to do anything in 2016.1 version. Wonder if anyone has an workaround. Thanks!

5 replies

takashi
Influencer
  • September 11, 2016

If you passed an attribute value to the parameter through the parameters dialog in the Main workflow, it may seem to do nothing because Workbench doesn't know the attribute value (i.e. prefix) when you are creating the workspace. However, I think the specified attributes will be renamed at run-time. Check the translation result with the Logger or the Feature Information pane of Data Inspector.


mark2atsafe
Safer
Forum|alt.badge.img+44
  • Safer
  • September 12, 2016

There are a couple of things necessary for this to work.

1) Create the custom transformer using "Handle With Published Parameters" for the Attribute References. If you don't do this then you will have to expose everything manually, which sort of defeats the purpose.

2) Create the custom transformer with the source data connected. If not the transformer won't know what attributes to expose inside it. The workaround here is to go to the Input port inside the transformer, open its properties dialog, and exposed the connected attributes there.

When I do these, then all works as you would expect (2016.1)


bo
Contributor
Forum|alt.badge.img+10
  • Author
  • Contributor
  • September 13, 2016
mark2atsafe wrote:

There are a couple of things necessary for this to work.

1) Create the custom transformer using "Handle With Published Parameters" for the Attribute References. If you don't do this then you will have to expose everything manually, which sort of defeats the purpose.

2) Create the custom transformer with the source data connected. If not the transformer won't know what attributes to expose inside it. The workaround here is to go to the Input port inside the transformer, open its properties dialog, and exposed the connected attributes there.

When I do these, then all works as you would expect (2016.1)

Mark, By exposing attributes in the input port of a transformer, we are "hard-wiring" the customer transformer with the workspace, am I right?

 


bo
Contributor
Forum|alt.badge.img+10
  • Author
  • Contributor
  • September 13, 2016
takashi wrote:

If you passed an attribute value to the parameter through the parameters dialog in the Main workflow, it may seem to do nothing because Workbench doesn't know the attribute value (i.e. prefix) when you are creating the workspace. However, I think the specified attributes will be renamed at run-time. Check the translation result with the Logger or the Feature Information pane of Data Inspector.

@takashi, you are right, the attributes under the new names actually were created in memory. This led to my solution below. Thank you!

 


bo
Contributor
Forum|alt.badge.img+10
  • Author
  • Contributor
  • September 13, 2016

Comments @takashi and @Mark2AtSafe help me solve this issue. The BulkAttributeRenamer did its work in memory, I just needed to ensure the custom transformer's Attribute Output mode was set to "All Attributes!"


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