Products | Versions |
---|---|
Spotfire Analyst | All Versions |
When writing a custom expression using the If() or Case function, the red exclamation point alert is displayed. You also cannot click the "OK" button, because the expression is deemed to be invalid, with the error "Invalid type for function call 'if'."
For example, using the If() function:
If([col1]=1,[col2],[col3])
Returns Arg2 if Arg1=true, and Arg3 if Arg1=false. Example: If(1 < 2, "Small", "Big")
Confirm that all output arguments of the If() and Case functions are of the same data type. If the columns used in output arguments are different data types, then it is possible to use the built-in conversion functions to force them to be the same data type.
For example, using the If() function:
If([col1]=1,String([col2]),String([col3]))
For example, using the Case function:
case when [col1]=1 then String([col2]) else String([col3]) end