Skip to main content
Solved

Dynamically copy attributes


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor

I have a set of csvs where the X,Y fields are named differently in each file, but always in the pattern {prefix}LocationX, {prefix}LocationY. The prefix is unrelated to the filename or any other easy way to predict.

 

In order to process all the files through the same workflow, I would like to copy the attributes to _x and _y so the rest of the transformers can reference those attributes irrespective of the original names.

 

Is there a simple way to do so without dropping into python?

Best answer by david_r

What about the BulkAttributeRenamer with regex renaming?

View original
Did this help you find an answer to your question?

4 replies

david_r
Evangelist
  • Best Answer
  • June 7, 2021

What about the BulkAttributeRenamer with regex renaming?


ebygomm
Influencer
Forum|alt.badge.img+32
  • Influencer
  • June 7, 2021

Two bulk attribute renamers using Regular Expression Replace, one for x, one for y. It looks like it should work on dynamic/unexposed attributes

Capture


jdh
Contributor
Forum|alt.badge.img+28
  • Author
  • Contributor
  • June 7, 2021

I forgot the BulkAttributeRenamer has a Keep Original Attributes mode. That will work.


jdh
Contributor
Forum|alt.badge.img+28
  • Author
  • Contributor
  • June 7, 2021
ebygomm wrote:

Two bulk attribute renamers using Regular Expression Replace, one for x, one for y. It looks like it should work on dynamic/unexposed attributes

Capture

For even more dynamism, one could have a single BAR wtih the Text to find be .*Location([XY]) and the String be _\\1. The downside to that is the attributes are not exposed on the canvas, but there is a very minor efficiency gain to BAR+attribute exposer compared to 2 BARs.

 


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