Can anyone advise why is my "IF" function not working?
Per the screenshots, the formula is working fine till I input "No" before "ENDIF".
Solved! Go to Solution.
Hi @Vanessa_JWS
Seems to be a data type issue. What data type is the 'check tax rate' field? You could wrap that in a 'ToString()' function, or remove the quotes around 10.
Hi @Vanessa_JWS. Based on the position of the red underline signalling error, my best guess is that your 'Check tax rate' variable is numerical, but you've wrapped the 10 in "" to indicate a string. If you remove that then it might work.
The problem you have encountered is datatype issue. Where the you are doing the comparison String datatype to Int datatype.
There are many possible solutions to overcome the datatype issue.
Solution 1: Use the SELECT tool, to convert datatype Int to String. And use the same existing formula.
Solution 2: You don't want to use the condition check 10 within quotes.
String datatype needs quotes. Int doesn't need it.
IF [Column_Name]=10
THEN "Yes"
ELSE "No"
ENDIF
Solution 3: You can rephrase the existing if function as below.
IF tostring([Column_Name])="10"
THEN "Yes"
ELSE "No"
ENDIF
Hope this helps!!!! Please ask if you have more questions.
Thanks! I didn't know the formula would not work if the data type if numeric..
Thanks! This is very helpful. I have resolved this issue!