Hi,
I have a TPS table which is keyed on AutoGuid. In the table is a ServiceDate ( long). On a browse, I filter it by AutoGuid and sort it descending on Service Date so that the most recent are at the top.
So, what I want to do is find the MOST RECENT service request for an AutoGuid in code.
The question then is how to code this - my first thought was to loop by AutoGuid and then do some manipulation to find the most recent one.
JSRV:Auto_GUID = loc:autoGUID
set(J_SRVREQ,JSRV:FK_AUTO)
loop while Access:J_SRVREQ.next() = Level:Benign
if JSRV:Auto_GUID = loc:autoGUID ! good match
! check dates here
ELSE
BREAK
END
END
I could make a new key with AutoGuid and Descending Service Date fields.
However, before I do this, I wondered if I could sort the result set by date descending with a Sort statement - that way the most recent would be the first record in the set? Not sure how this might be coded?
Can folks supply some code and insight?
Thanks,
Ron