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"):
Desired Output:
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?
Solved! Go to Solution.
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.
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.
@courtneyq
I hope I get your intention correctly.
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.
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.
This is the best I got, so I'll leave it up to the experts for further help.
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.
Name | val | Test |
jsmith | qqqq | abcd |
psmith | qadq qq | bcde |
wsmith | aaaaaaaaaaaaaaaaaa | defg |
asmith | 123 | fghi |
Workflow
Output
Username | val | Username2 |
jsmith | qqqq | abcd |
psmith | qadq qq | bcde |
wsmith | aaaaaaaaaaaaaaaaaa | defg |
asmith | 123 | fghi |
@Yoshiro_Fujimori That worked perfectly - thank you so much!