We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Malformed IF Statement

aoifemccormack
5 - Atom

I'm trying to fix the following error in my flow and don't have much Alteryx experience to solve what probably is a simple issue.

The expected utilisation rate data is recorded in the below format:

aoifemccormack_1-1673351643342.png

 

I keep getting this error when trying to run my flow: Parse Error at char(99): Malformed If Statement (Expression #1)

Can someone tell me what I'm doing wrong?

aoifemccormack_0-1673351441641.png

 

8 REPLIES 8
davidskaife
14 - Magnetar

Hi @aoifemccormack 

 

You need to provide an 'Else' and 'Endif' clause, for example:

 

 

If [what is the expected utilisation rate?] > 1
THEN [what is the expected utilisation rate?]/100
ELSE xx
ENDIF

where xx is the default output if the IF statement doesn't work

 

JamesCharnley
13 - Pulsar

Hi @aoifemccormack 

 

Editing because I didn't read the Q properly in my haste. The above answer should cover it, just check that the data types are correct as well and you should be good

davidskaife
14 - Magnetar

Good spot @JamesCharnley 

 

@aoifemccormack  you're trying to apply a numerical calculation to a string field:

 

DavidSkaife_0-1673352329891.png

 

aoifemccormack
5 - Atom

Thanks both! @JamesCharnley @davidskaife 

Another beginner question here sorry, but what should I change the data type to to accept the calculation?

davidskaife
14 - Magnetar

Hi @aoifemccormack 

 

As it's decimal places Double works well

JamesCharnley
13 - Pulsar

No worries @aoifemccormack 

 

You'll want some kind of numeric data type that allows decimals. Fixed decimal, float or double should all work in this instance. I truthfully just default to double pretty much any time unless working with large data sets

@aoifemccormack to add on - I will use Fixed more often because I can set the number of decimal points (19.2 would be two decimal points, 19.3 would be 3 decimal points). 

EdwardCochrane
7 - Meteor

If in doubt about what data type to use, you can always insert an Autofield tool into your flow. Just check to make sure that Alteryx has made the correct decision/that the decision fit your intended use case (for example, some of Alteryx's choices do not always work nicely with excel further down the line).

Labels
Top Solution Authors