Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.
Free Trial

Alteryx Designer Desktop Discussions

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

Conditional If Statemenet without an ELSE statement

dgcolby
6 - Meteoroid

I am working on a workflow that I plan on Optimizing, however, I am first just trying to understand the methodology that was used. I pull the data, create a new output column and begin populating the column by apply three IF conditions.

 

IF [PRODUCT]= "F C C C" THEN "FCCC"
ELSEIF [CLASS]= "G" THEN "Gliders"
ELSEIF [DEALER CODE]= "DD17" THEN "Corp - Ryder Program"
ELSE NULL()
ENDIF

 

Then I need to apply two more conditions that contain an AND clause with the intent to populate the newly created output column. For example, 

 

IF [CATEGORY]= "MEXICO" && [PRODUCT]= "FTL" THEN "Mexico Domestic Units"

IF [MARKET]="MEX" && [CATEGORY]= "Clearing" THEN "Mexico Domestic Units"

 

I am working with an initial set of month data, and the above "MEXICO" conditions are not true ... yet .... but they will be true in future months ... nonetheless I get the following error message, "The field " " is not contained in the record (Expression #2). Normally, we add the ELSE & ENDIF clauses, but for what I am trying to accomplish, if the statement is not true I don't want it to do anything. I thought that this was possible, but am unsure how to write the expression. 

 

Any help would be great.

 

Regards,

 

Darin

 

 
 
2 REPLIES 2
patrick_digan
17 - Castor
17 - Castor

@dgcolby 1) Could you use an or statement to condense your logic and use the null if it doesn't match?

IF ([CATEGORY]= "MEXICO" && [PRODUCT]= "FTL") || ([MARKET]="MEX" && [CATEGORY]= "Clearing") THEN "Mexico Domestic Units" Else Null() ENDIF

2) That error usually means you need to set the field name (either an existing field or create a new one). Let me know if your issue is something else. Note that it would be the second formula based on the error message.

Annotation 2019-10-09 123836.jpg 

 

CharlieS
17 - Castor
17 - Castor

@dgcolby wrote:

"The field " " is not contained in the record (Expression #2).

This usually means you need to assign a new name to Expression #2 in your Formula tool, or select an existing field for it to apply to. 

Labels
Top Solution Authors