Alteryx Designer Desktop Discussions

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

IF IN THEN ELSEIF ELSE ENDIF "Parameter # has a type mismatch" ERROR

tho03049
6 - Meteoroid

I cannot get this formula to work, I have tried changing the formula case, Data Type, variations of IF statements... no dice. The Data type of the field being referenced is V_String, so it cannot be that.  Help.Formula Error IF IN ELSEIF.png 

4 REPLIES 4
Emmanuel_G
13 - Pulsar

@tho03049 

 

At the first glance, I think the main issue in your If statement comes from the ||.

 

If you want to use the IN operator to select multiple values, you must use a comma instead of the ||. For example : IF [Action Reason Description] IN ("INV: Attendance","INV: Breach of trust",....).

 

The || is identical to OR so you use ir when you want to combine many logical tests in a signe IF/ELSEIF statement such as IF [Value1] = 1 || [Value2] = 1 THEN "OK" ELSE "Nothing" ENDIF.

 

Can you test it and confirm if it works ?

 

caltang
17 - Castor
17 - Castor

One good way to check is to paste your IF statement into Notepad++ and check out the syntax from there. But I agree with @Emmanuel_G's first assessment. The || may be causing some issues.

 

Other than that, I think your malform IF condition comes from not properly closing a statement with a IF a THEN b ELSEIF c THEN d ELSE e ENDIF, this happens more often than we'd like. Retrace your steps and split the portions of your statement into a, b, c, d, and e as per the IF statement structure to see what went wrong.

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
Pang_Hee_Choy
12 - Quasar

I suggest you build a table in excel or in text input.

 

ActionTerm type
INV: AttendanceInvoluntary
INV: Breach of trustInvoluntary

 

then join and union then use formula to adjust the blank column like below.

Pang_Hee_Choy_0-1686799456978.png

 

 

Cassagni
5 - Atom

Hello tho03049 !

 

Have you tried to change the data type to V_WString ?

 

V_String: "If the string greater than 16 characters and varies in length from value to value."

V_WString:  "If the string greater than 16 characters and varies in length from value to value. If the string contains unicode and is longer than 16 characters, use V_WString, such as a "Notes" or "Address" field."

 

Good Luck !

 

Gabriel Cassagni

Labels