Alteryx Designer Desktop Discussions

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

NESTED IF STATEMENT

keithr197
7 - Meteor

Hello, I was wondering if anyone could help me with this. I am using the formula tool to apply the following formula to a column, however im receiving an error:

 

IF IsEmpty ([PARTY TYPE])= 1 THEN "Entity" ELSEIF [PARTY TYPE]=2 THEN "Individual" ELSE "Investigation" ENDIF

 

Can anyone please help

3 REPLIES 3
AngelosPachis
16 - Nebula

Hi @keithr197 ,

 

The ISempty function does not need and =1 sign after it so that's probably what's causing the error. Try

 

IF IsEmpty ([PARTY TYPE]) THEN "Entity" ELSEIF [PARTY TYPE]=2 THEN "Individual" ELSE "Investigation" ENDIF

 

Hope that helps, let me know if that worked for you.

 

Cheers,

 

Angelos

keithr197
7 - Meteor

Hi @AngelosPachis

 

Thanks for your prompt response however im still getting an error.

Error: "Invalid type in operator=="

AngelosPachis
16 - Nebula

Ah I see @keithr197 ,

 

That error is probably because the [Party Type] field is a string, but you're comparing it against a numeric value. Try wrapping the 2 in quotation marks, so

 

[Party Type]="2"

 

or

 

you can convert the field [Party Type] into a number just for this expression by using the ToNumber function, so

 

ToNumber([Party Type])=2

 

Hope that does it.

Labels