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

Parse Error at Char(603): Malformed If statement (Expression #1)

fagoagaf
6 - Meteoroid

I need help in fixing an error I'm seeing. Can you provide guidance?

 

iif([Total Days at Integrator's Warehouse]<=30,
[Days at Integrator's Warehouse for Calc Period]*(0.XXX/366)*[Unit PO Material Price]*[Qty for CoC],
iif([Total Days at Integrator's Warehouse]>30 and [Total Days at Integrator's Warehouse]<181,
[Days at Integrator's Warehouse for Calc Period]*(0.XXX/366)*[Unit PO Material Price]*[Qty for CoC],
iif([Total Days at Integrator's Warehouse]>=181,
((([Days at Integrator's Warehouse for Calc Period]-[days for higher rate]*(0.XXX/366)*[Unit PO Material Price]*[Qty for CoC]+[days for higher rate]*(0.XXX/366)*[Unit PO Material Price]*[Qty for CoC]))),0))

10 REPLIES 10
dougperez
12 - Quasar

Prueba esto:

iif([Total Days at Integrator's Warehouse]<=30,[Days at Integrator's Warehouse for Calc Period]*(0.XXX/366)*[Unit PO Material Price]*[Qty for CoC],
iif([Total Days at Integrator's Warehouse]>30 and [Total Days at Integrator's Warehouse]<181,[Days at Integrator's Warehouse for Calc Period]*(0.XXX/366)*[Unit PO Material Price]*[Qty for CoC],
iif([Total Days at Integrator's Warehouse]>=181,
(
(
(
[Days at Integrator's Warehouse for Calc Period]-[days for higher rate]*(0.XXX/366)*[Unit PO Material Price]*[Qty for CoC]+[days for higher rate]*(0.XXX/366)*[Unit PO Material Price]*[Qty for CoC]
)
)
),0)))

fagoagaf
6 - Meteoroid

When I try re-running the workflow, I still get a parse error at char(605):malformed if statement (expression #1). I see that the error is tied to this section of your recommendation:

 

(
(
(
[Days at Integrator's Warehouse for Calc Period]-[days for higher rate]*(0.066/366)*[Unit PO Material Price]*[Qty for CoC]+[days for higher rate]*(0.095/366)*[Unit PO Material Price]*[Qty for CoC]
)
)
),0)))

 

 

fagoagaf
6 - Meteoroid

I also see this message:

 

Formula: tried to apply numeric operator to string value

dougperez
12 - Quasar

All these fields are numerical?

Maskell_Rascal
13 - Pulsar

Hi @fagoagaf 

 

The formula fix that @dougperez provided is correct. The reason you are still getting an error is because one of the fields in your formula is stored as a string and needs to be converted to a numeric type (double, int64, etc.). Once you correct this, the formula will work as expected. Just drop a Select tool on the canvas before the Formula tool and flip the data type over to Double. 

Maskell_Rascal_0-1631218036184.png

Maskell_Rascal_2-1631218067878.png

 

Hope that helps

 

Cheers!

Phil

fagoagaf
6 - Meteoroid

Yes. They are.

fagoagaf
6 - Meteoroid

I did apply the suggestions you made, but I'm getting a parse error at (485): formula tried to apply numeric operator to string value (expression #1)

dougperez
12 - Quasar

Can you show the select tool before this formula?

Maskell_Rascal
13 - Pulsar

@fagoagaf - as I stated before, one of your fields is not a numeric field but is instead a string. The error you are receiving can only happen when this applies. 

 

Based on your screenshot, the field in question is [days for higher rate]

 

Here is a screenshot where I was able to recreate the same problem because this field is stored as a string.

Maskell_Rascal_0-1631281774273.png

Maskell_Rascal_1-1631281785018.png

 

When I change this field to a double, the error goes away. 

Maskell_Rascal_2-1631281858946.png

Maskell_Rascal_3-1631281868857.png

 

Update you field type and you should be good. 

 

Thanks!

Phil

 

 

Labels