SOLVED
(Another) Malformed "IF" statement question
Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
DPRC
8 - Asteroid
‎07-15-2020
03:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
Solved! Go to Solution.
Labels:
- Labels:
- Topic of Interest
4 REPLIES 4
17 - Castor
‎07-15-2020
03:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You need a + between "SC" and [Safety Code] in the ELSEIF and remove the + before "SC"
purnimat
7 - Meteor
‎07-15-2020
03:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
This should do the trick. Though not sure if the output is what you are looking for 🙂
seven
12 - Quasar
‎07-15-2020
04:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @DPRC
the replies have helped you to resolve this case. This is how you can train yourself in every case:
- 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.
- 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.
- 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:
This makes the problem even more evident. It is then fixed as shown below:
‎07-15-2020
05:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you all for your replies and assistance.
