How can we retrieve first value of an attribute from a database table?

seenunandagiri

New Member
Hi,

I am new to the progress. I am building an employee timesheet application where login time and logout times for a particular day should be recorded. I used,

create inout .
assign inoutTime=NOW .


above code to store the timings. but, the problem is whenever i execute the code, present time values are stored. I need first login value. So, help me in getting the first value of an inoutTime column.

EmpNum inoutTime
123 09:33 AM
123 10:22 AM
123 11:22 AM

in the above table I need 09:30 Am to be diplayed.please help me .
 
This works for integer time, but you are using these new-fangled Date-Time variables, so you might have to change it.

Code:
DEFINE VARIABLE iLoginTime AS INTEGER NO-UNDO.
 
FIND FIRST InOut NO-LOCK NO-ERROR.
IF AVAILABLE InOut THEN ASSIGN iLoginTime = InOut.InOutTime.
 
MESSAGE STRING (iLoginTime,"hh:mm:ss") VIEW-AS ALERT-BOX.
/*or */
 
 
FOR EACH InOut NO-LOCK BREAK BY InOut.InOutTime:
  ASSIGN iLoginTime = InOut.InOutTime.
  LEAVE.
END.
 
MESSAGE STRING (iLoginTime,"hh:mm:ss") VIEW-AS ALERT-BOX.
 
Back
Top