Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

QUESTION --> IF c THEN t ELSE f ENDIF

PedroPerdomo
7 - Meteor

Hi There,

good morning,

 

I am stuck trying to get a Workflow done, this is my issue: in a table I have different customers under [consignee names] but each customer goes to a different terminal (new column that i would like to create with that terminal, so I did a formula using IF for the first customer, but I don't know how to create it for the next customers.

 

Ex (everything ok through here). 

IF [Consignee Name]="Customer1" THEN "Column AA" ELSE "" ENDIF

 

So I need to continue the formula adding

Customer 2 to Column AB

Customer 3 to Column CD 

etc etc.

 

Any help I will appreciate it.

Thanks in advance,

 

 

 

 

17 REPLIES 17
SahadhKuruniyan
8 - Asteroid

I am facing same issue

SahadhKuruniyan_0-1634376082084.png

When I try to put ENDIF everything become black

SahadhKuruniyan_1-1634376132515.png

 

ChrisTX
16 - Nebula
16 - Nebula

@SahadhKuruniyan can you post your workflow? 

 

Is your field name spelled correctly?

 

"Differeces" versus "Differences"

 

Chris

 

olsenprime
5 - Atom

Thanks @SamDesk! I had an ENDIF problem and had no idea about adding the last ELSE statement!

Barclaysusercds
8 - Asteroid

I want to use the IF formula but it does not like my less than <. What is wrong with the below?

Thanks

 

IF [RACE_ACCT]<20000000 THEN "Long" ELSE "Short" ENDIF

ChrisTX
16 - Nebula
16 - Nebula

@Barclaysusercds the formula looks OK, depending on data types.

 

What is the data type for the field [RACE_ACCT]?   It should be numeric, since your formula uses a numeric value.

 

And what is the data type of the field you are writing to in the Formula tool?  If you're updating an existing field, is it a String data type?  If you're creating a new field, did you set the Formula tool to create a String data type?

 

Chris

Barclaysusercds
8 - Asteroid

Ah ok [RACE ACCT] was VWString, I changed it to Double and it worked. Thank you.

APGUIMARAES
5 - Atom

I am having the same issue, but no idea how to solve it.

 

 

Captura de tela 2024-10-18 141335.png

ChrisTX
16 - Nebula
16 - Nebula

@APGUIMARAES an IF function must have an ELSE clause.  What do you want the value to be if the first two IF clauses are not true?

 

You can use "Null()" without the quotation marks in the ELSE clause.

 

Chris

Labels