record pointer

hi supposing in a table there are 100 records, i want to point to starting from 50th record through 100 records. i dont want to use any filters. to be more precise i have report1 which if the total records found in the dataitem is more than 20 then report1 will print the first 20 records and then run another report say report2 for the remaining records. thanx in adv. MK

Hi! Maybe you can implement some counters? e.g.

Report1
OnAfterGetRecord()
VarCounter1 := VarCounter1 + 1;
IF (VarCounter1 > 20) THEN BEGIN
  REPORT.RUNMODAL(Report2, [...]);
  CurrReport.QUIT;
END;
Report2
OnAfterGetRecord()
VarCounter2 := VarCounter2 + 1;
IF (VarCounter2 <= 20) THEN
  CurrReport.SKIP;

Best Regards, Jörg

Can you use an INTEGER-Primerykey ?

Joerg, if you pass the record variable to the RUNMODAL function, does the called report pick up the current record and start from where the first report ended?

Hi Jorg infact even i had the same idea , but again as questioned by xorph , how will the second report pick records from the 21st one. as far i see it we should be able to tell the second report to start from 21st record(but how do we?) MK

quote:


Joerg, if you pass the record variable to the RUNMODAL function, does the called report pick up the current record and start from where the first report ended?


No, not in that way. That’s why I suggested a second counter in Report2, to skip the first 20 records in that example. The filters on the DataItems in each report have to be the same (transfering filters is no problem). In my little example, Report1 would do any processing only for the record 1 to 20, then - at record 21 - start Report2 (same filters!), and quit Report1; Report2 would skip processing records 1 to 20, and start with record 21 … Maybe it would be also necessary to set the BreakPoint dynamically by another function … (Well, I’ve never tested this, it’s just a theoretical solution [;)]) Best Regards, Jörg

Hi, You can use MARK function while generating the first report and list all the unmarked records in the second reports.

Hello. If you pass the record as an variable to the report2, hence: REPORT.RUNMODAL(Report2, rec); the record pointer will remain in its last position. However, if you wish to make it idiot proof, you might want to lock this table and use GETPOSITION and SETPOSITION functions. /Tero

hi tero would u be bit more clear with regard to the GETPOSITION and SETPOSITION…with an eg probably. thank you MK

Hi, those functions are explained also in the C/SIDE reference guide that ships with financials, but here’s an example: 1. define a long(e.g. 90) text variable (here FilePos ) 2. To get the position of record pointer, call: FilePos := rec.GETPOSITION(FALSE);, I use false for field names, so that fields are refered to by their numbers instead of names. I don’t know wheter makes any difference, but at least I wont get in trouble with language versions, and the text variable is less prone to overflow. 3. Then when you need to return to original postion, just call: rec.SETPOSITION(FilePos); If you debug that code, you will see that the FilePos includes keyfield values after calling GETPOSITION. Hope this helps. /Tero