Skip to main content
Solved

Dynamically copy attributes

  • June 7, 2021
  • 4 replies
  • 29 views

jdh
Contributor
Forum|alt.badge.img+40

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?

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

david_r
Celebrity
  • Best Answer
  • June 7, 2021

What about the BulkAttributeRenamer with regex renaming?


ebygomm
Influencer
Forum|alt.badge.img+46
  • 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+40
  • Author
  • Contributor
  • June 7, 2021

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


jdh
Contributor
Forum|alt.badge.img+40
  • Author
  • Contributor
  • 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

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.