community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Malformed if Statement

Atom

I am trying to write an IF- sentence.

I have 3 different conditions

 

But when I wrote

 

IF [x] == 'string1' or [x] == 'string2' and [y] != 'string3'

Then  [z] = 0

Else [z]

ENDIF

 

This should return INT values as a 0 (when IF sentence is true) or the original number (when IF sentence is false)

For the original numbers (false) it works fine, but for 0 (true) it returns -1 instead of 0

 

 

Why / what have I done wrong?

 

-Antti Jokela-

Asteroid

Hi PAFIN,

 

I wrote the same expression as you have written.The workflow is returning 0 for me and not -1. It might be because of the data type of column [Z]

 

Could you please share thee workbook so that I can see through it and help you out.

 

Thanks,

Amit Belagali

 
ACE Emeritus
ACE Emeritus
You just need "0" not "[z]=0" ... please try:

IF [x] == 'string1' or [x] == 'string2' and [y] != 'string3'
Then 0
Else [z]
ENDIF

Hope that helps!
Labels