Navigating through SQL Data
pete at lcsql.com
Thu Dec 12 14:08:19 EST 2013
You might want to think about using revQueryDatabase to create a database
cursor. The processing for your buttons then becomes:
It's a bit more longwinded to display the data from your query because you
have to use revDatabaseColumnNamed to get each column from the current
record in the cursor. Also watch out for the fact that the cursor is
zero-indexed not 1.
If you stick with revDataFromQuery, you would need to keep the current line
number of tRecords somewhere (say tLinenum), then:
First: put 1 into tLinenum
Prev: if tLinenum> 1 then subtract 1 from tLineNum
Next: if tLinenum < the number of lines in tRecords then add 1 to tLineNum
Last: put the number of lines in tRecords into tLinenum
Then use "line tLinenum of tRecords" to get your data. You can also
disable/enable the buttons depedning on where you are in tRecords, for
example, you'd disable Prev if you're at record #1 so you don't need the
check in the Prev button for tLineNum>1.
lcSQL Software <http://www.lcsql.com>
On Thu, Dec 12, 2013 at 10:00 AM, Magicgate Software - Skip Kimpel <
skip at magicgate.com> wrote:
> What is the best way to navigate through records retrieved through this
> put revDataFromQuery(tab,return,tResult,tSQL) into tRecords
> I am using arrow buttons for first, last, next and previous. Need to
> figure out the code for those buttons.....
> Thanks in advance!
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
More information about the Use-livecode