Hi.
I'm new to alteryx and exploring the functions in my day to day work.
While i tried putting a If condition as below, there is an error which says " Error: Formula (10): Parse Error at char(93): Malformed If Statement (Expression #1)". Can any one please correct me in the code below?
IF SubString([F8],11,1)="I"
THEN [F32]
ELSE IF [F45]=0
THEN [F32]
ELSE (-[F32]-[F45])
ENDIF
Thanks in advance.
Solved! Go to Solution.
The "ELSE IF" should not have a space in Alteryx expressions. Try this:
IF SubString([F8],11,1)="I"
THEN [F32]
ELSEIF [F45]=0
THEN [F32]
ELSE (-[F32]-[F45])
ENDIF
Edit: Solution was already posted.
HI @Charlie S
Thanks for your swift response.
When i use the below code, there is an error highlighted as:
"Error: Formula (10): Parse Error at char(0): Type mismatch. String provided where a number is required. (Expression #1)"
Can you please help on this?
Thanks
Ravi
Sure thing.
It looks like your ELSE result performs an arithmetic operation on two fields: "(-[F32]-[F45])". Since numeric values are needed, you could add this conversion into the formula so you don't have the change the field types of [F32] and [F45] ahead of this:
(-ToNumber([F32])-ToNumber([F45]))
Now that this operation is valid, a numeric value will be produced. The field is a string, so we need to make sure this part of the expression outputs a string value. We can wrap this with "ToString(" to make sure a string value is output in this string field.
ToString((-ToNumber([F32])-ToNumber([F45])))
Thank you very much. Now this is working fine.
wrong post