Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Dynamic Rename of Constantly Changing Field Name

MarieanneG
5 - Atom

I have a workflow where a field name changes from one month to the next (i.e. Prior Month = "Assets as of 7/1/23", Current Month = "Assets as of 8/1/23"). I want the workflow to convert the field name to always equal "Assets". Attached is a workflow to show what the input file looks like for a given month. It would also be helpful if the replacement field name is positioned in the same location as the original field name.

 

Because my Alteryx skill level is intermediate, I'm looking for a non-macro solution 😁.

4 REPLIES 4
ChrisTX
15 - Aurora

Use the Dynamic Rename tool, Rename Mode = Formula, Formula = 

 

IF
StartsWith([_CurrentField_],"Assets as of ") THEN "Assets"
ELSE [_CurrentField_]
ENDIF

 

 

 

Screenshot 2023-09-14 105121.png

 

Chris

Prometheus
12 - Quasar

@MarieanneG If your input is an Excel file, you can configure it to push your field names down one line by selecting the check box next to "First Row Contains Data." Then you can use a Dynamic Input tool to change all the field names to the value in the first row of data, except for F4, which is where you'll have your field name that constantly changes. After that, you can use a Select tool to change "F4" to "Assets."

Input Config1.PNG

Exclude F4.PNG

Rename Assets.PNG

ChrisTX
15 - Aurora

One side effect of using the option "First Row Contains Data".... all fields will be imported as data type V_String or V_WString

 

MarieanneG
5 - Atom

The first solution didn't work since the field name was missing from the dynamic rename tool after I ran the workflow with a different as of date. The 2nd solution solved for this. Thank you both!

Labels