SQLitening Support Forum

SQLitening Support => You've got Questions? We've got Answers! => Topic started by: cj on August 13, 2011, 02:08:41 pm

Title: Display single or multiple records forward or backward by any key
Post by: cj on August 13, 2011, 02:08:41 pm
What would be the correct sql statement be to browse forward or backward on any key?
Something like this?
SELECT * FROM TABLE$  WHERE Key$ < CurrentKey$  LIMIT Number$
SELECT *   FROM TABLE$  WHERE Key$ > CurrentKey$ LIMIT Number$

Not sure about getting lowest and highest  key

Something like this?
FUNCTION  GetRec(Table$, Key$, Direction$, Number&) AS STRING
   SELECT statement
   FUNCTION  = RecordSet$
END FUNCTION

Is there a common sub or function to return the recordset in this manner?

Anyone have an example using PBFORMS?
This would really help me get going on converting to sql.

Would it be possible to write a single function that does about everything needed to browse
without having to write sql statements?   Just pass the parameters instead?


Thank you
Title: Re: Display single or multiple records forward or backward by any key
Post by: Rolf Brandt on August 13, 2011, 07:35:51 pm
Here is a sample with code:

http://www.sqlitening.com/support/index.php?topic=3014.msg15347#msg15347 (http://www.sqlitening.com/support/index.php?topic=3014.msg15347#msg15347)

Rolf
Title: Re: Display single or multiple records forward or backward by any key
Post by: cj on August 13, 2011, 08:48:46 pm
Exactly what I needed to get going.

Thank you!
Title: Re: Display single or multiple records forward or backward by any key
Post by: Fred Meier on August 13, 2011, 09:11:33 pm
You also may want to study Example C.  It has an example of using slSelAry which is a very efficient way to go back and forth thru a set of records.
Title: Re: Display single or multiple records forward or backward by any key
Post by: cj on August 13, 2011, 09:15:49 pm
Thank you very much..
I will convert the demos to PBFORMS and post when done.
I really like using an array or tab delimited file to feed into a grid.