Skip to main content
Question

BulkAttributeRenamer dynamically rename attributes

  • 11 August 2023
  • 5 replies
  • 93 views

I have the following problem:

 

I have a csv file with multiple columns. I have a user parameter and i want to rename the columns according to this user parameter.

 

Even though the "Text To Find" parameter of my BulkAttributeRenamer gets updated correctly the Renamer doesn't rename the correct column but renames the previously set column and deletes the values in the newly set column (see pictures).

 

The BulkAttributeRenamer only renames the new column correctly if I:

   - open the BulkAttributeRenamer properties

   - replace "Text To Find" Parameter with something arbitrary

   - close the BulkAttributeRenamer by clicking "Ok"

   - open the BulkAttributeRenamer properties again

   - set the "Text To Find" parameter back to my user parameter

   - close the BulkAttributeRenamer by clicking "Ok"

 

 

I'm using FME Desktop 2020.2.3.0 on Windows 10

Maybe someone can tell me if this is a bug or if I'm just overlooking something.

 

 

Many thanks in advance !

5 replies

Userlevel 4
Badge +17

The attribute is being renamed, it's just not exposed anymore.

If the BulkAttributeRenamer is set to rename attributes based on regular strings, then the attributes before and after are knowable. If a parameter is used, then the attribute names before and after are not knowable before the translation happens and that parameter is set, so the workbench shows the last known value of that rename. If you are dynamically renaming attributes, then you need to work with unexposed attributes.

Screenshot is of a rename, same as you've done, renaming and replacing a '3' with a '5'. In the feature information window, the attributes are there and correctly renamed.

image

Badge +1

Thanks for the quick response. How do i work with unexposed attributes/what would i need to change in the example i gave? I've played around with it for a while and i think i see your point at least partially but this behavior seems very unintuitive.

Userlevel 4
Badge +17

The example you gave seems to be fine, probably only thing is you'll want to do all the calculations from or using of the attribute value before you rename it. Once it's renamed, you can't work with it as easily, pretty much all you can do is write it out (which would be the whole reason for dynamically renaming it).

Exposing attributes isn't so intuitive because normally FME does it automatically so you don't have to worry about it. But once you expose an attribute, it's no longer dynamic.

Badge +1

Hm ok, then my last question would be: Why does it work the first time?

 

When I define a column name in a user parameter and set this user parameter as the "Text To Find"-Parameter in the in the BulkAttributeRenamer it works as expected. But as soon as I change the value of the user parameter it doesn't.

 

PS.: If I change the user parameter, save the workbench, close the workbench and then reopen the workbench it works as well until I change the user parameter again.

Hm ok, then my last question would be: Why does it work the first time?

 

When I define a column name in a user parameter and set this user parameter as the "Text To Find"-Parameter in the in the BulkAttributeRenamer it works as expected. But as soon as I change the value of the user parameter it doesn't.

 

PS.: If I change the user parameter, save the workbench, close the workbench and then reopen the workbench it works as well until I change the user parameter again.

I also want to know.

 

 

 

 

 

 

 

I also want to know.If you need help writing an case study but don't know how to start,I wholeheartedly recommend you can visit this https://www.topessaywriting.org/case-study-help website. This service offers essay writing services and can help you complete your essays quickly.

Reply