Hi,
Having problems print the last record of a report. The last record is printed but it is repeated equal to the number of records found in the source table. For example if there are ten records in the source table the last record will be printed ten times.
Below is the code am using to fetch the last record:
NRAPay.SETCURRENTKEY(RecordCount);
NRAPay.SETRANGE(RecordCount);
IF NRAPay.FIND('+') THEN BEGIN
CurrReport.SHOWOUTPUT;
END ELSE CurrReport.SKIP;
Please help! ](*,)
Few years ago we were not existing and few years to come we would be in the grave! So what will benefit us in the grave?
Answers
Just try it by removing first 2 lines...
:!:
One would be to maintain a variable called recIndex that increments everytime you go through the data item.
This is not very elegant and requires much more processing than is necessary. I would use a slightly modified version of what you have.
Let me know if that doesn't make sense.
My Blog - nav.education
OnPreDataItem
NRAPay.SETCURRENTKEY(RecordCount);
NRAPay.SETRANGE(RecordCount);
IF NRAPay.FIND('+') THEN
LastRecord:= NRAPay.RecordCount;
NRAPay.RESET;(if necessary)
OnAfterGetRecord
CurrReport.SHOWOUTPUT := NRAPay.RecordCount = LastRecord;
Ufuk
Pargesoft
I have solved it and below is how I did it:
OnPreDataItem: And OnAfterGetRecord: