Progress Database 4GL - 导出文件的数学计算
Progress Database 4GL - Math calculate for export file
下面的语句将会执行。但是,我想要 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.
如果您只想除以 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.
下面的语句将会执行。但是,我想要 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.
如果您只想除以 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.