Hello, my dynamic rename formula has been renaming both columns even though the second one does not meet the criteria which is no spaces, numbers, punctuation and must be between 3 - 15 characters in length.
Weirdly when running the different formula tools, the formula is returning the correct values.
The "val" heading should not be renamed to "Username" just the "Name "column:
Any tips or guidance helps!
Solved! Go to Solution.
@courtneyq
formula updated
If length([_CurrentField_])> 3 AND
length([_CurrentField_])<= 15 AND
!contains([_CurrentField_], " ") AND
!contains([_CurrentField_], "0") AND
!contains([_CurrentField_], "1") AND
!contains([_CurrentField_], "2") AND
!contains([_CurrentField_], "3") AND
!contains([_CurrentField_], "4") AND
!contains([_CurrentField_], "5") AND
!contains([_CurrentField_], "6") AND
!contains([_CurrentField_], "7") AND
!contains([_CurrentField_], "8") AND
!contains([_CurrentField_], "9") AND
!contains([_CurrentField_], "!") AND
!contains([_CurrentField_], "@") AND
!contains([_CurrentField_], "#") AND
!contains([_CurrentField_], "$") AND
!contains([_CurrentField_], "%") AND
!contains([_CurrentField_], "^") AND
!contains([_CurrentField_], "&") AND
!contains([_CurrentField_], "*") AND
!contains([_CurrentField_], "(") AND
!contains([_CurrentField_], ")") AND
!contains([_CurrentField_], "_") AND
!contains([_CurrentField_], "-") AND
!contains([_CurrentField_], "+") AND
!contains([_CurrentField_], "=") AND
!contains([_CurrentField_], "{") AND
!contains([_CurrentField_], "[") AND
!contains([_CurrentField_], "}") AND
!contains([_CurrentField_], "]") AND
!contains([_CurrentField_], "|") AND
!contains([_CurrentField_], "\") AND
!contains([_CurrentField_], ":") AND
!contains([_CurrentField_], ";") AND
!contains([_CurrentField_], "<") AND
!contains([_CurrentField_], ".") AND
!contains([_CurrentField_], ">") AND
!contains([_CurrentField_], "?") AND
!contains([_CurrentField_], "/") AND
!contains([_CurrentField_], ",") AND
!contains([_CurrentField_], "~")
Then "Username"
else [_CurrentField_] endif
find workflow attached
mark done if solved.
Hey @courtneyq, the Dynamic Rename tool evaluates the field names themselves and not the column values. Therefore, you're checking whether 'Name' and 'Val' satisfy your conditions, which they do, hence why they're both being converted to 'Username' - are you trying to do this or just change the values within the column? If it's the former you'll have to build in some extra logic/checks to exclude 'Val' from being changed.
@courtneyq
insted you can use
"IF Regex_Match([_CurrentField_], '^[a-zA-Z]{4,15}$') THEN "Username" ELSE [_CurrentField_] ENDIF"
easy to understand.
@Raj one of the checks mentioned in the original post is that the length must be 3-15 characters. Starting your checks off with:
If length([_CurrentField_])> 3 AND
length([_CurrentField_])<= 15 AND
Ensures that this is 4-15 characters.
@DataNath as he mentioned between 3-15 and as per his condition
"Val" should not be included
i updated it.
@DataNath How can I change the column headers based on whether the values below it meet the criteria? I did not realize the dynamic rename only looks at the value of the headers.
Glad that you have the RegEx squared away and I think you were on the right path by flipping the data around with Transpose & Crosstabs tools. I think this is related to this other post, right? I added a workflow there: