I'm trying to input this code to generate state initials but I'm getting errors with my if statements. I thought it had to end with endif?Please can someone help me out?
I would suggest to apply tool 'Find Replace' for your case. I will really simplify your long formula.
Do you need help with applying this tool?
Karolina
Hi @MosesAddai24 ,
I think the issue is with your else clauses. Only the last clause should be an else, with everything else being an else if clause.
Please check the sample formula below:-
if contains([Header(State)],"HAWAII" )
then "HI"
elseif contains ([Header(State)],"ALASKA" )
then "AK"
elseif contains ([Header(State)],"ALABAMA" )
then "AL"
else "Default"
endif
Also attached is a sample workflow for your reference.
Do let me know if this resolves the error.
Best,
Jagdeesh Narayanan
Thanks! I was able to use the find and replace tool in the data source
fyi- your original if/then/else/endif grouping had an error at character 27 - you didn't post the first screen shot of the beginning of your formula which is where there error would have been - but I expect that you didn't close a "]" or are missing a comma or a ")" somewhere...
Yh i reviewed the font and it appears that the alteryx could not recognize my commas because they were smart quotes. It works now. Thanks!