I have a dataset where I need to dynamically rename two columns based on their column position for changes made to reflect a new year. I am able to pull the field information and date into a stream where I use the Dynamic rename tool, but this isn't connected to the full dataset.
Thinking there should be an easier way to do this. Right now I am trying to transpose the columns to rows and then figure out a way to rename based on position this way. Below is a very simple visual of what I am needing to accomplish. Rename the name of the 4th column to a NewName.
Solved! Go to Solution.
Hi @binuacs, I think that would get it, but I'm really not REGEX literate lol. There are 4 years with the same name structure but different years. So the exact format is "FY YYYY" descending down by year. So, the first one is in column 21 and the 2nd that I need is in column 24 the other 2 are in position 27 and 30.
Column #21 needs to be FY "Next Year" and Column #24 needs to be FY "Current Year"
Hi @SDJ57
Please find the tweaked formula for Year 2022.
IF contains([_CurrentField_],("Year "+left(datetimeadd(DateTimeNow(),-1,"year"),4)))
THEN "NewName"
ELSE [_CurrentField_]
ENDIF
Many thanks
Shanker V
Hi @SDJ57
Please find the output for FY 2022 and FY 2021.
IF contains([_CurrentField_],("FY "+left(datetimeadd(DateTimeNow(),-1,"year"),4)))
THEN "Next Year"
ELSEIF contains([_CurrentField_],("FY "+left(datetimeadd(DateTimeNow(),-2,"year"),4)))
THEN "Current Year"
ELSE [_CurrentField_]
ENDIF
Input was:
Many thanks
Shanker V
Thank you @ShankerV! This will work! =)
Thank you @binuacs! That is slick, I haven't used the tile before!
@SDJ57 sorry I misunderstood your requirement, Do you mean to add the text "Next Year" instead of adding the given year + 2?
@binuacs no, you got it correct. I shouldn't have had a quote around that text as I was referring to the literal number of the next year. Thank you!