SQL Subfile and position to ability

50 pts.
Tags:
SELECT statement
SETLL
SQL
Subfile
I have a subfile that can be sorted by any of 4 fields, so I want to use imbedded SQL to read the data out of my PF in order to populate the subfile. I want to be able to allow the user to enter position to information, and position to that entry - normally, I would do a SETLL to the file based on the position to info, but I can't do that in SQL can I? I know I can read all the subfile entries until I get to the entry I need, but I am wondering if this is really the only way to get to it? or I could refetch records from the start until I reach the entry I want. II don't really want to load all entries to the subfile at startup - only one page at at time. I can easily do a SELECT where data field >= Position to field, but then how do I do a pageup without having to do another SELECT statement? I would really want to be able to do FETCH PRIORS Any suggestions?

Answer Wiki

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

You can loop through the subfile to find the desired record
with a for loop
for x = 1 to currentSFSize
x chain subfilerecord name

use the x value of the desired record to set the variable for the SFLRCDNBR
The SFLRCDNBR should be conditioned with (CURSOR) and that’s all that’s necessary to
get your cursor on a particular record of the subfile.

A SFLRCD 4S 0H SFLRCDNBR(CURSOR)

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
  • Gilly400
    Hi, I would use the select where >= and not allow the pageup from that position - after all the user has requested data >= something, if they want data before that, they should adjust their selection. Regards, Martin Gilbert.
    23,730 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