I have a report that I need to find all Sales Invoices Posted during a date range. From those records I need to find the oldest sales invoice for the job number listed in the posting range to grab the original installer for the job. Can I have the Sales Invoice Table defined as a dataset, sorted by the posting date, to grab the posting date range records, then define the Sales Invoice table again as a global variable(SIOrig), setting the currentkey as posting date and filter on the job number? It should grab the first occurrence of the job number in post date order? And is the posting date order by default ascending or descending? This would determine whether I used the findfirst or findlast correct? Something like this?
Sales Invoice - afterrecord()
SIOrig.SETCURRENTKEY(SIOrig."Posting Date"); **SIOrig being second Sales Invoice
SIOrig.SETFILTER(SIOrig."Job No.","Sales Invoice Header"."Job No."); defined in global variables
SIOrig.FINDFIRST();
ORIGINALINSTALLER := SIOrig."Head Installer";
ORIGINALINSTALLERNAME := SIOrig."Head Installer Name";
*This post is locked for comments
I have the same question (0)