Do you use Alteryx in a language other than English? If so, we want to hear from you! Please help us improve the international experience of our products by participating in this 5 minute survey.

We are updating the requirements for Community registration. As of 7/21/21 all users will be required to register a phone number with their My Alteryx accounts. If you have already registered, you will be prompted on your next login to add your phone number.

Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

Formula: Error

MosesAddai24
7 - Meteor

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?

6 REPLIES 6
KarolinaRoza
11 - Bolide

Hi @MosesAddai24 

 

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

 

jagdeeshn
11 - Bolide

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

MosesAddai24
7 - Meteor

I changed the else statements but it's still not working.

MosesAddai24
7 - Meteor

Thanks! I was able to use the find and replace tool in the data source

apathetichell
15 - Aurora

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...

MosesAddai24
7 - Meteor

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!

Labels