Alteryx Designer Desktop Discussions

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

Automatically Rename Column if the Values Below Meets Criteria

courtneyq
7 - Meteor

Hello, is it possible to rename the column if the values below it meet certain criteria? I have tried creating a workflow in order to convert it but am stuck. 

 

I'd like the column to be titled "Username" if it meets all the criteria. 

 

Issue ("Username2" is supposed to still say "val"): 

Issue.png

 

Desired Output: 

Desired Output.png

 

The furthest I've gotten is flagging whether each value meets the criteria but not how to implement the renaming of the header itself since the dynamic renaming formula uses the column heading values and not the fields below it. In addition, I do not want to manually select the specific field to rename or use a filter tool to manually pick the fields, it should be automatic based on the macro/workflow. 

 

Any thoughts on how to achieve this? 

6 REPLIES 6
Erin
10 - Fireball

I might not understand completely, but the attached seems to work with the sample...

 

I added a record ID first. Then I checked the Copy Output Fields and Add box in the multi field formula tool. In the transpose and the crosstab, I checked the box to group by record ID. I reordered the records after the crosstab by the record ID, but maybe you want them to stay sorted by Name? Lastly I renamed the "Name" field to "Username" with a select tool and removed record ID.

 

2024-06-06_16-32-33.png

courtneyq
7 - Meteor

Thank you for your reply @Erin  - My goal is to not rename the heading to "Username" manually since different inputs I use may have the "Username" field titled differently and I am looking to update the field if it falls within my criteria within the Regex formula. My guess is that the potential solution could involve the action tool or the dynamic rename somehow.

Qiu
21 - Polaris
21 - Polaris

@courtneyq 
I hope I get your intention correctly.

0607-courtneyq.png

Erin
10 - Fireball

Ah ok, attempt number 2.... this is closer but not there yet because for the jsmith line, "qqqq" meets the conditions of Username since it is between 3-15 characters and doesn't contains spaces or special characters. 

2024-06-06_18-10-20.png

 

Never fear, try try again! I added a tile tool to get a row ID per record ID basically, and then added a condition to the multifield formula tool to only look at the first row ID per record ID to rename. I used this path over selecting first in the crosstab in case that the value is somehow sorted before the username. This worked for this sample data set, but in the real world it isn't full proof if Username isn't in the first column coming in. I didn't add any select tools, but you'll probably want to remove record ID downstream.

2024-06-06_18-16-54.png

This is the best I got, so I'll leave it up to the experts for further help. 

Yoshiro_Fujimori
15 - Aurora

Hi @courtneyq ,

 

To keep the order of columns of the original table, I added another flow.

There might be a better way, but I think this is one way.

I hope this helps.

 

Input

I added another column "Test" to see if the second "good" column works.

NamevalTest
jsmithqqqqabcd
psmithqadq qqbcde
wsmithaaaaaaaaaaaaaaaaaadefg
asmith123fghi

 

Workflow

1282235_Workflow.png

 

Output

UsernamevalUsername2
jsmithqqqqabcd
psmithqadq qqbcde
wsmithaaaaaaaaaaaaaaaaaadefg
asmith123fghi

 

 

courtneyq
7 - Meteor

@Yoshiro_Fujimori  That worked perfectly - thank you so much!

Polls
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Labels