Alteryx Designer Desktop Discussions

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

Parse Error on ENDIF

YLYONG
9 - Comet

YLYONG_0-1629559195161.png

Hello Alteryx Community,

Reaching out for help to solve this error message. 
Thank you

8 REPLIES 8
AngelosPachis
16 - Nebula

Hi @YLYONG ,

 

First of all your dates should be placed within quotation marks and this is what causes the error. So your if statement should look like :

 

 

IF [ORDER DAY]="THU" THEN "22/07/2021"
ELSEIF ...

 

 

I can also see that you have selected the data type of the ORDER_DATE field to be a Date. Alteryx recognises dates when those are in the yyyy-mm-dd format so you might want to rethink of changing the values to "2021-07-22" or change the column data type to a V_String.

 

Hope that helps,

Angelos

Elias_Nordlinder
11 - Bolide

Hello @YLYONG ,

 

The answer from @AngelosPachis is very good and fixes most of the things,

there is just one thing I want to add.

 

* The error itself from your formula actually comes from that you have a condition

in the ELSE-clause.

 

You wrote the end of the formula as:

"ELSE [Order Day] = "Wed" THEN 28/07/2021"
ENDIF

 

One cannot have condition in the else clause and the best way is

to add one more elseif clause first like this, then ELSE "" in the end.

In that way you can keep your condition that you had for wednesday:

ELSEIF [Order Day] = "Wed" THEN 28/07/2021"
ELSE ""
ENDIF

 

This is also possible without another ELSEIF clause, by just writing

ELSE 28/07/2021
ENDIF

 

But the problem with that is if you have any other Order Days that are misspelled, they

will also get the date 28/07/2021, as everything that is not MON,TUE,THU,FRI,SAT,SUN

will get that date.

 

Therefore the first solution is more safe.

 

After just changing the ELSE-clause in the end, this workflow would actually be able to run,
but the answer would be very wierd as @AngelosPachis mentioned.
The result would be like this, if you still would have the type as date:

 

Elias_Nordlinder_1-1629627659467.png

 

Therefore after changing this I would do the suggestions that was outlined above.

 

1. Add citation signs and change to String Type.

 

2. Add citation signs and change to correct Date format and keep Date Type.

 

//Regards
Elias

 

YLYONG
9 - Comet

Thank you both Angelo and Elias for your input.

Both formulas worked in Elias's workflow. However, when I copied and pasted both solutions onto my workflow, and it is still showing the same errors:

 

 

YLYONG_0-1629631025969.png

 

YLYONG_1-1629631082194.png

 

 

 

Spoiler
Spoiler
Spoiler
 
AngelosPachis
16 - Nebula

Nice catch @Elias_Nordlinder, I totally missed that! Also well done for putting the time to write such a comprehensive post 👍

 

@YLYONG Can you please let us know what's the data type of the [Order Day] field? Maybe you can share part of the workflow so we can have a look, and save you time going back and forth?

 

Best,

Angelos

YLYONG
9 - Comet

Hi @AngelosPachis,

 

The data type of the [Order Day] is double. 

The reason I chose 'double' is becuase I need to sum the [Order Day]

I have changed to formula replacing [Order Day] with [Day] which is a string and this fixes the error.

YLYONG_3-1629633159086.png

 

 

 

YLYONG_5-1629633215269.png

YLYONG_6-1629634994785.png

 

 

 

 

 

AngelosPachis
16 - Nebula

@YLYONG Yes that would make more sense, as Alteryx won't be able to Sum "Thu" with "Sat" as you can't apply a mathematical operator between strings.

 

Does the workflow works as expected now that you've applies that fix?

YLYONG
9 - Comet

@AngelosPachis @Elias_Nordlinder yes, this makes sense now and the workflow is working fine. Thank you for your assistance. 

YLYONG
9 - Comet

@AngelosPachis @Elias_Nordlinder, yes the workflow is working fine and is making sense now. Thank you for your assistance!

Labels