[Stackoverflow] [Progress OpenEdge ABL] Simplify Case When If then statement

Status
Not open for further replies.
J

Jack Williams

Guest
I have been provided the following CASE WHEN statement from our MIS provider. I am looking at simplifying this as im no expert so the easier it is for me to read the more chance i have to understand and learn.

Current statement:

,CASE SopOrderItem.SoiProcessMethod:WHEN 0
THEN IF SopOrderItem.SoiReplenishmentOrder
THEN DO: IF SopProduct.SopPrePostPaid = 0
THEN ASSIGN lv-ProcessMethod = "Replenishment Pay on Replenishment".
ELSE ASSIGN lv-ProcessMethod = "Replenishment Pay on Delivery".
END.
ELSE lv-processmethod = "Call Off":U.
WHEN 1 THEN lv-processmethod = "On Demand":U.
WHEN 2 THEN lv-processmethod = "Personalised":U.
END CASE


This is what i have been able to write from which i know that works the part i am stuck on is WHEN SopOrderItem.SoiProcessMethod = 0. At this point i do not understand the statement. From what i can tell in English it is saying when SopOrderItem.SoiProcessMethod is 0 then check to see if SopProduct.SopPrePostPaid is also 0 if both are true then "Replenishment Pay on Replenishment" if not then "Replenishment Pay on Delivery".

Is there a way i can simplify the statement to make it easier for me to understand.

I have the below statement at the moment but this has caused my query to fall over and take ages to refresh:

CASE WHEN SopOrderItem.SoiProcessMethod = 1 THEN 'On Demand'
WHEN SopOrderItem.SoiProcessMethod = 2 THEN 'Personalised'
WHEN SopOrderItem.SoiProcessMethod = 0 AND SopProduct.SopPrePostPaid = 0 THEN "Replenishment Pay on Replenishment"
WHEN SopOrderItem.SoiProcessMethod = 0 AND SopProduct.SopPrePostPaid <> 0 THEN "Replenishment Pay on Delivery"
ELSE 'Call Off'
END

Continue reading...
 
Status
Not open for further replies.
Top