Single Page subfile for duplicate records

35 pts.
Duplicate records
Can you please tell me the how to handle the pageup & pagedown in single page subfile ....(In Physical file keyfield have douplicate records e.g. Douplicate Policy Number )

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi S22

You’ve chosen to create tricky little piece of code.

The duplicate records make it impossible to find your place if you move the record pointer in other processing.
So any other processing should be by another access path.

When you initially load the subfile you probably read one extra record so you can set the *more indicator
That extra record would be the initial read for the page down.

Load Routine (used initially, used on page down, used after pageup routine
1. Clear Subfile
2. record# = 1
2 while record# <= subfileMax and not eof(myfile)
3. load first record
4. read myfile
5. record# += 1
6. enddo

and you’ve got the one extra record to set the *more indicator.

PageUp — uses readp to walk up the file to the correct position\
record# = 1
while record# <= subfileMax+1 and not eof(myfile)
READP myfile <– backup into the file
record# += 1
if %eof(myfile)
setll (xxx) myfile <– use low value if it weren’t keyed
Read myfile

then do the routine above to load.

the Setll is required because when the readp reaches top of file the pointer is not positioned to read the first record.

Good luck
ohhhh … page up error… while record# <= subfileMax+1 and not eof(myfile)
that only gets to the top of the current page .. should be:
while record# <= 2 * (subfileMax) +1 and not eof(myfile)
Yorkshireman has a good point but I don’t think it can work quite like he suggested, not if you want to load the data using a keyed data set. However, his record number could be used on a second access path without the key
That would be used to access the records for updating/deleting.

Discuss This Question: 1  Reply

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Yorkshireman
    add a record number field to the subfile record, and populate it as you load. The subfile page / refresh routines thereafter can use the record numbner field to position.
    6,085 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: