进度数据库4GL - 导出文件的数学计算

时间:2017-12-21 14:17:33

标签: sql openedge progress-4gl progress-db

以下陈述将执行。但是,我希望wShipment.Volume除以1728并导出该结果。

例如,如果wShipment.Volume是3456,那么它应该将结果2导出到报告中。

OUTPUT TO \\tsclient\U\All_Orders_item.csv.

FOR EACH r4_wms.wShipmentDet NO-LOCK,

FIRST r4_wms.wShipment OF r4_wms.wShipmentDet NO-LOCK where wShipment.shipmentNO>6500 and wShipmentDet.Owner="MIDEAUS",

FIRST r4_wms.wOrder OF r4_wms.wShipmentDet NO-LOCK,

FIRST r4_wms.wOrderline OF r4_wms.wShipmentDet NO-LOCK
 BY wShipment.ShipmentNo DESC:

EXPORT DELIMITER ","

           wOrder.OrderNo

           wShipment.Volume

           wShipment.Weight SKIP.   

 END.

 OUTPUT CLOSE. 

1 个答案:

答案 0 :(得分:4)

如果您只想除以1728,则可以在EXPORT语句中执行此操作:

wShipment.Volume / 1728

但是“1728”听起来像是在寻找立方英尺(12 x 12 x 12)。如果你需要体积的最小整数立方英尺,你可以像这样计算:

DEFINE VARIABLE RoundedVol AS INTEGER NO-UNDO.

RoundedVol = TRUNCATE(wShipment.Volume / 1728, 0).
IF wShipment.Volume MOD 1728 > 0 THEN 
    RoundedVol = RoundedVol + 1.

然后将RoundedVol添加到EXPORT语句中。它会给你任意分数的立方英尺。所以对于1729的音量,你将获得2。