Skip to main content

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?

What about the BulkAttributeRenamer with regex renaming?


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


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


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.

 


Reply