我们的MIS提供者已向我提供以下CASE WHEN
声明。我正在将其简化为不是专家,因此我越容易阅读,就越有机会理解和学习。
当前声明:
,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
这就是我能够写的内容,据我所知,我卡住的部分是WHEN SopOrderItem.SoiProcessMethod = 0
。在这一点上我不明白这一说法。用我能用英语告诉我的是,当SopOrderItem.SoiProcessMethod为0时,然后检查SopProduct.SopPrePostPaid是否也为0(如果两者都为真),如果不是,则检查“ Replenishment Pay on Replenishment”,然后再检查“ Delivermentment Pay on Delivery”。>
有没有一种方法可以简化语句,使我更容易理解。
此刻我有以下声明,但这导致我的查询失败并且需要花很多时间才能刷新:
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