I need assistance with creating a function that will return the last date value from a table that fits two conditions.
This is what I have so far:
PARAMETER RTNO
LOCAL F,DBFTRACE
F=ALIAS()
RETVAL=''
USE DBFTRACE ORDER TAG ROUT_NO ASCENDING IN 0 ALIAS DT AGAIN
SELECT DT
SEEK RTNO
SCAN WHILE ROUT_NO=RTNO AND DESCRIPTIO='Release Work Order'
RETVAL=DTOC(LOG_DATE)
ENDSCAN
USE
SELECT (F)
RETURN RETVAL
But when I incorporate the function into my report, I do not get the correct date value. If I remove the "DESCRIPTIO" condition, then it will return the last date for the first condition with no problems.
Please excuse my ignorance, as I am only an amatuer with programming. Any help is appreciated.
Rick
This is what I have so far:
PARAMETER RTNO
LOCAL F,DBFTRACE
F=ALIAS()
RETVAL=''
USE DBFTRACE ORDER TAG ROUT_NO ASCENDING IN 0 ALIAS DT AGAIN
SELECT DT
SEEK RTNO
SCAN WHILE ROUT_NO=RTNO AND DESCRIPTIO='Release Work Order'
RETVAL=DTOC(LOG_DATE)
ENDSCAN
USE
SELECT (F)
RETURN RETVAL
But when I incorporate the function into my report, I do not get the correct date value. If I remove the "DESCRIPTIO" condition, then it will return the last date for the first condition with no problems.
Please excuse my ignorance, as I am only an amatuer with programming. Any help is appreciated.
Rick