首页 > 解决方案 > 如何使用progress 4gl计算昨天的记录和今天的记录?

问题描述

我写了一个程序,我需要用今天的记录来计算昨天的记录(从 12:00 AM 到 05:00 AM)

for each womf_worder of sfcf_au_ship where 
         womf_worder.word_production_status EQ "B"                      and 
         womf_worder.word_build_date        EQ today - 1                and 
         womf_worder.word_build_time        GE tt_shift.shft_start_hour and
         womf_worder.word_build_time        LE tt_shift.shft_stop_hour  
         no-lock: 

    assign i = i + 1.
end.

但问题是我只需要用今天的记录计算那些提到的时间(12:00 AM 到 05:00 AM)的订单。你能帮助这个案子吗?

标签: openedgeprogress-4gl

解决方案


如果您知道您的数据中没有“未来”日期,则可以使用以下内容:

for each womf_worder of sfcf_au_ship where 
         womf_worder.word_production_status EQ "B"                      and 
         womf_worder.word_build_date        GE today - 1                and 
         womf_worder.word_build_time        GE tt_shift.shft_start_hour and
         womf_worder.word_build_time        LE tt_shift.shft_stop_hour  
         no-lock: 

  assign i = i + 1.
end.

如果您不熟悉您正在使用的数据或希望它更便携:

for each womf_worder of sfcf_au_ship where 
         womf_worder.word_production_status EQ "B"                      and 
         womf_worder.word_build_time        GE tt_shift.shft_start_hour and
         womf_worder.word_build_time        LE tt_shift.shft_stop_hour  and
         ( womf_worder.word_build_date      eq today - 1                or
           womf_worder.word_build_date      eq today                       )
         no-lock: 

  assign i = i + 1.
end.

推荐阅读