Alteryx Designer Desktop Discussions

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

IF_Then malformed statement please help

Karl_Spratt
8 - Asteroid

Hi Guys,

Can you please help getting  malformed statement error. 

Want to say if the item is flagged in a prior formula in the WF as a KBB_Item do a if / then statement I wrote it as below.  But getting an error can someone please help?

 

IF [KBB_Item]= 'KBB_Item' THEN [KBB_Loop_Qty]-([CBL_Total_Dmd]+ [WO Required Quantity])<='0'
then 'Review_KBB_Loop' ELSE "OK"
ENDIF

 

Capture.PNG

8 REPLIES 8
JosephSerpis
17 - Castor
17 - Castor

Hi @Karl_Spratt can you remove the quotation marks around the 0 in your IF Statement. You only need quotation marks if its text and not a numeric value.

Kenda
16 - Nebula
16 - Nebula

Hey @Karl_Spratt 

 

It looks like you're trying to do a nested if statement? If so, it seems as though you forgot your second "if" so something like 

 

IF [KBB_Item]= 'KBB_Item' THEN IF [KBB_Loop_Qty]-([CBL_Total_Dmd]+ [WO Required Quantity])<='0'
then 'Review_KBB_Loop' ELSE "OK" ENDIF ELSE ...
ENDIF

Maskell_Rascal
13 - Pulsar

Hi @Karl_Spratt 

 

Try this: 

IF [KBB_Item] = 'KBB_Item'  AND [KBB_Loop_Qty]-([CBL_Total_Dmd]+[WO Required Quantity])<=0 THEN 'Review_KBB_Loop' ELSE "OK" ENDIF

 

Since you are using two logic statements, you need to add an "AND" command between them instead of the "THEN" command you initially used. 

 

If this solves your issue please mark the answer as correct, if not let me know!

 

Thanks!

Phil

 

RobertOdera
13 - Pulsar

Hi, @Karl_Spratt 

 

1. If you have sequential conditions to consider, you might use ELSEIF

 

IF [KBB_Item]= 'KBB_Item' THEN [KBB_Loop_Qty]-([CBL_Total_Dmd]+ [WO Required Quantity])<='0'

 

ELSEIF (whatever the second sequence of conditions)


then 'Review_KBB_Loop' ELSE "OK"
ENDIF

 

2. If you have concurrent conditions to consider, you might want to use AND

 

IF [KBB_Item]= 'KBB_Item' THEN AND [KBB_Loop_Qty]-([CBL_Total_Dmd]+ [WO Required Quantity])<='0'

 

then 'Review_KBB_Loop' ELSE "OK"
ENDIF

 

3. If you prefer to use nested arguments, you might try IIF arguments instead of IF --> ELSEIF

 

Cheers!

Karl_Spratt
8 - Asteroid

Thank you that worked. 

Karl_Spratt
8 - Asteroid

Hi Guys,

 

How can I amend this formula to say. if the KBB_Item Column doesn't have the KBB_Item value ( It's blank / not populated in  import file), make these items in the formula as "Non_KBB_Items", otherwise run this formula on the column. 

 

 

IF [KBB_Item] = 'KBB_Item' AND [KBB_Loop_Qty]-([CBL_Total_Dmd]+ [WO Required Quantity])<=0
THEN "Review_KBB_Loop" ELSE "OK"
ENDIF

 

Capture.PNG

TIA.

Karl

Maskell_Rascal
13 - Pulsar

Hey @Karl_Spratt 

 

You'd just need to add another logic statement at the beginning. 

IF IsEmpty([KBB_Item])
    THEN 'Non_KBB_Item'
ELSEIF [KBB_Item] = 'KBB_Item'  AND [KBB_Loop_Qty]-([CBL_Total_Dmd]+[WO Required Quantity])<=0 
    THEN 'Review_KBB_Loop' 
ELSE "OK" 
ENDIF

 

If this solves your issue please mark the answer as correct, if not let me know!

 

Thanks!

Phil

Karl_Spratt
8 - Asteroid

Thanks Phil that worked. 

Cheers Karl. 

Labels