Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

(Another) Malformed "IF" statement question

DPRC
8 - Asteroid

Hi,

 

I keep getting an error message for the beneath code and i'm not sure as to why.

 

Can someone please advise what I have done wrong.

 

Thank You

 

DPRC_0-1594807740813.png

 

4 REPLIES 4
DavidP
17 - Castor
17 - Castor

You need a + between "SC" and [Safety Code] in the ELSEIF and remove the + before "SC"

purnimat
7 - Meteor

This should do the trick. Though not sure if the output is what you are looking for 🙂

 

 

purnimat_0-1594810041306.png

 

seven
12 - Quasar

Hi @DPRC 

 

the replies have helped you to resolve this case. This is how you can train yourself in every case:

 

  1. syntax highlighting - look for the point where the colour "stops". Alteryx will change the colours of text in the Formula expression editor to show differences between functions, text, field names, etc. Alteryx will stop changing colours the moment it encounters something it cannot parse. In this case, between "SC" and [Safety Code]. In every case, it is meant to draw your attention to where the malformed IF statement is going awry.
  2. red underlining - look for the red jagged underlining. Alteryx will sometimes underline, using a red jagged line, the part of the expression it cannot parse. In this case, between "SC" and [Safety Code]. In every case in which it appears, it functions just like any modern text editor and shows a typo or mistake or something else to fix. One would be hard pressed to find a person who isn't familiar with this red jagged underline.
  3. use newlines and expression formatting - write expressions in a way that makes errors stand out even more. In this case, the expression could be rewritten like this:
     
     

    image.png

    This makes the problem even more evident. It is then fixed as shown below:

    image.png

     

DPRC
8 - Asteroid

Thank you all for your replies and assistance.

Labels