Free Trial

Alteryx Designer Desktop Discussions

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

Malformed IFTHEN Statement

MattR79
8 - Asteroid

Hi Everyone,

 

I am trying to compare several fields from two data sources and I want to get only one Pass/Fail back as a response.  There are 26 fields I am trying to compare and if any of them match to their corresponding value in the other input I want to get a fail.  I need to compare the values from the Codes in column A to the Field Names in column D from the attached. I tried to do the below IFTHEN statement but it keeps coming back as malformed.  Am I able to do it in this way or is there some other method I need to use?

 

if [L/C Orig Effective Date] != [LC ISSUE/ADVISE DATE] then 'Fail' elseif
if [L/C True Expiry Date] != [EXPIRY DATE] then 'Fail' elseif
if [LC Amount in Native Currency] != [OUTSTANDING LIABILITY BALANCE] then 'Fail' elseif
if [LC Currency] != [CURRENCY] then 'Fail' else 'Pass' endif

2 REPLIES 2
Nanoq
8 - Asteroid

You don't need the extra if after each elseif - it's already contained in the elseif. If that doesn't work, i would check if the columns you're comparing are the same data types - I'm seeing that error way too often

 

 

DawnDuong
13 - Pulsar
13 - Pulsar

hi @MattR79 

I personally find that introducing line breaks help to make the syntax easier to read. In this case, every elseif already contains "if" so you don't need the extra "if". note that only 1 "endif" is required and you can see the reason why from the line breaks belwo.

 

if [L/C Orig Effective Date] != [LC ISSUE/ADVISE DATE]

then 'Fail'

elseif [L/C True Expiry Date] != [EXPIRY DATE] then 'Fail'

elseif [LC Amount in Native Currency] != [OUTSTANDING LIABILITY BALANCE] then 'Fail'

elseif [LC Currency] != [CURRENCY] then 'Fail'

else 'Pass'

endif

 

Cheers,

Dawn.

Labels
Top Solution Authors