Single Page subfile for duplicate records

35 pts.
Tags:
Duplicate records
Subfile
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 )
ASKED: February 19, 2009  7:50 AM
UPDATED: February 20, 2009  7:10 PM

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
Enddo
if %eof(myfile)
setll (xxx) myfile <– use low value if it weren’t keyed
endif
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
Phil
/////////////////////////
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.
Phil

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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • 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.
    5,520 pointsBadges:
    report

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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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

Following