Question

Add parameter as prefix to selected attributes in custom transformer

  • 11 September 2016
  • 5 replies
  • 5 views

Badge +2

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

Userlevel 3
Badge +17

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.

Userlevel 4
Badge +26

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)

Badge +2

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?

 

Badge +2

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!

 

Badge +2

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

Reply