Alteryx Designer Desktop Discussions

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

Formula Function-Parse Error

ekurutz
6 - Meteoroid

I am at a total loss as to why this formula is not working. I have this exact formula in another workflow and it works fine, however, I keep getting an error that says "Parse Error at char(2840): Invalid type in operation= =, (Expression #2).

 

ekurutz_0-1624649756170.png

 

3 REPLIES 3
apathetichell
19 - Altair

have you considered using a matching table and a join - that IF statement is fairly error prone... As I I can't see something specifically - can you post the error message? If it's the last part (ie the 8299 clause) - omit it and see if it runs and if it does just add it back.

Maskell_Rascal
13 - Pulsar

While I don't believe there is a maximum number of IF/THEN/ELSEIF statements in Alteryx, I agree with @apathetichell's assessment. From the formula you provided, you'd be better served with a separate file containing the list of numbers and their corresponding values and then using a Find/Replace to add to the data. 

 

One other note, you'd be better served using the IN function in your original formula as opposed to writing out all those IF/THENs. 

 

 

IF [MCC_NUMBER] IN (4829,6010,6011,6050,6051,6533,6536,6537,6538,6540) 
THEN "Money Transfer" 
ELSEIF [MCC_NUMBER] IN (8011,8021,8041,8042,8049,8050,8062,8071,8099)
THEN "Medical"
ELSEIF [MCC_NUMBER] IN (8211,8220,8241,8244,8249,8299)
THEN "Schools"
ELSEIF [MCC_NUMBER]=5122
THEN "Drugs, Drug Proprietors, and Druggists Sundries" ELSE "NO" ENDIF

 

 

 

Luke_C
17 - Castor
17 - Castor

I third the suggestion of a mapping table - that will make the workflow much easier to maintain in the future should there be any new mappings or if any mappings ever change. Depending on the use case, you could make it an excel that other people can update instead of having to bug you to update the formula!

Labels
Top Solution Authors