Alteryx Designer Desktop Discussions

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

Multiple IF statements and variable assignments in 1 formula field

LadyNaureen
7 - Meteor

Dear Community Team

 

I have one formula field say MATCHED_OR_NOT and want to add below logic but this code is giving error. Can you please help me to analyze what is wrong with following code:

 

IF [GENDER1] = "E" OR ISNULL([GENDER1]) OR IsEmpty([GENDER1] THEN

                                           IF [AGE_CALC] = [AGE_AT_ENTRY] THEN

                                                              "DIRECT - Y"

                                           ELSE

                                                              "DIRECT - N"

                                           ENDIF

ELSE

                                         IF [ORIG_AGE] = [AGE_AT_ENTRY] THEN

                                                         "DIRECT - Y"

                                        ELSE

                                                        "DIRECT - N"

                                        ENDIF

ENDIF   

 

Thank you.

 

Regards,

LadyN

3 REPLIES 3
markcurry
12 - Quasar

Hi @LadyNaureen, you seem to missing a ) after .....OR IsEmpty([GENDER1]) THEN

 

Also, the function IsEmpty will return true for both Nulls and Empty cells, so you don't need the IsNull part in the first line.

 

Hope that helps.

apathetichell
19 - Altair

In addition to @markcurry 's observation - you only need 1 endif - at the very end of your statement. I also rely upon a strict if/then/elseif/else/endif structure.

 

There are multiple other things though that could be going wrong - so if you can post some sample data, or screengrabs of the error messages that would be helpful in pinpointing other sources of errors - i.e. mismatched field types etc...

ArtApa
Alteryx
Alteryx

Hi @LadyNaureen - You simply forgot to put in a parenthesis ")"

 

ArtApa_0-1622694232113.png

 

Labels