I am creating a dashboard to show the hourly production data. Need to use the logic to show last 12 hours data. Example: Column 1: >= 01:00:00 and < 02:00:00 Column 2: >= 02:00:00 and < 03:00:00 Below is the logic I use: DEFINE TEMP-TABLE tt_data NO-UNDO FIELD ICOUNT AS INTEGER. FIELD cSHPAU AS CHARACTER FIELD cWOBDDDT AS DATE FIELD cWOBTIME AS INTEGER FIELD cWordID AS CHARACTER. DEFINE TEMP-TABLE tt_time NO-UNDO FIELD A AS INTEGER LABEL "00:00:00 TO 00:59:59" FIELD B AS INTEGER LABEL "01:00:00 TO 01:59:59" DEFINE VARIABLE iTime AS INTEGER NO-UNDO. DEFINE VARIABLE dDate AS DATE NO-UNDO. iTime = TIME - 12 * 3600. dDate = NOW. EMPTY TEMP-TABLE tt_data. FOR EACH sfcf_au_ship NO-LOCK, EACH sfcf_au OF sfcf_au_ship NO-LOCK, EACH womf_worder OF sfcf_au_ship WHERE womf_worder.word_production_status = 'B' AND womf_worder.word_build_time >= iTime AND womf_worder.word_build_date >= dDate NO-LOCK: CREATE tt_data. ASSIGN tt_data.cWordID = womf_worder.word_id tt_data.cWOBDDDT = womf_worder.word_build_date tt_data.cWOBTIME = womf_worder.word_build_time tt_data.cSHPAU = sfcf_au.assu_id. IF tt_data.cWOBTIME >= ( 00 * 60 * 60 ) AND TIME < ( 01 * 60 * 60 ) THEN DO: FIND tt_time NO-LOCK NO-ERROR. ASSIGN tt_data.cWOBTIME = tt_time.A. END. IF tt_data.cWOBTIME >= ( 01 * 60 * 60 ) AND TIME < ( 02 * 60 * 60 ) THEN DO: FIND tt_time NO-LOCK NO-ERROR. ASSIGN tt_data.cWOBTIME = tt_time.B. END. END. Continue reading...