Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

IF statement inserts 0

marcin2x4
9 - Comet

I wrote a simple if statement:

 

IF [Party Office] = "GULFESTMED"
THEN  [Party Office] = "Gulf East Med"
ELSE [Party Office]
ENDIF

 

Instead of text it inserts value 0 to the attribute. Input format of the field is V_String.

Should I set up a different format ?

8 REPLIES 8
LordNeilLord
15 - Aurora

Hey @marcin2x4,

 

That all looks correct, can you take a screen shot of the workflow and output? Or attach your workflow?

marcin2x4
9 - Comet

image.png

LordNeilLord
15 - Aurora

Can you share the an example of the incorrect output and the formula tool setup as well?

rahul1011
8 - Asteroid

Since you are already selecting the field on which you are using the formula, you don't need to add it in the then section.

 

Try the below:

 

IF [Party Office] = "GULFESTMED"
THEN  "Gulf East Med"
ELSE [Party Office]
ENDIF
LordNeilLord
15 - Aurora

Good spot @rahul1011

marcin2x4
9 - Comet

So funny thing here, after removing the attribute name in THEN part it actually worked.

 

Input:

image.png

 

Output (before formula change):

image.png

 

Output (changed formula):

image.png

 

 

 

rahul1011
8 - Asteroid

Thanks @LordNeilLord

 

@marcin2x4: hope this resolves your issue

marcin2x4
9 - Comet

Yes @rahul1011, great thanks!

@LordNeilLord - thanks as well!

Labels
Top Solution Authors