AndrewMozley
Programmer
There is a report which is a listing of bank transactions. It reads its records sequentially from one table XARCB.
Each of these records can have one or more associated records in a table XARCT; this table includes a field ID_XARCB which refers to its parent record, a Line_no and a description. It has a primary index with key STR(ID_XARCB) + STR(Line_no).
So there could be between one and ten records in XARCT for a particular record in XARCB.
The report scans through XARCB, and for each record it comes across it likes to find any non-blank description (Desc) from the detail file XARCT. The program used to do this with the instructions :
This worked pretty well, but when the user asks for a listing with hundreds of records in the final report, it runs very slowly: the reason is that each LOCATE instruction in the loop is taking nearly a second, so I have not optimised the processing !
I had vaguely hoped that Rushmore optimisation would help to speed up the processing of the LOCATE instruction. I must be wrong!
What is the simplest way that I can make use of the existence of the index on the XARCT table to retrieve a record (with a non-blank Desc field) to match the current XARCB record.
Thanks. Andrew Mozley
Each of these records can have one or more associated records in a table XARCT; this table includes a field ID_XARCB which refers to its parent record, a Line_no and a description. It has a primary index with key STR(ID_XARCB) + STR(Line_no).
So there could be between one and ten records in XARCT for a particular record in XARCB.
The report scans through XARCB, and for each record it comes across it likes to find any non-blank description (Desc) from the detail file XARCT. The program used to do this with the instructions :
Code:
CREATE CURSOR cResult . . .
SELECT XARCB
SCAN <for range of dates>
* Append a record to the cursor CRESULT
* populate that record with relevant fields from XARCB
SELECT XARCT
LOCATE FOR ID_XARCB = XARCB.ID .AND. !EMPTY(Desc)
SELECT cResult
REPLACE cDesc WITH XARCT.Desc
ENDSCAN
This worked pretty well, but when the user asks for a listing with hundreds of records in the final report, it runs very slowly: the reason is that each LOCATE instruction in the loop is taking nearly a second, so I have not optimised the processing !
I had vaguely hoped that Rushmore optimisation would help to speed up the processing of the LOCATE instruction. I must be wrong!
What is the simplest way that I can make use of the existence of the index on the XARCT table to retrieve a record (with a non-blank Desc field) to match the current XARCB record.
Thanks. Andrew Mozley