Navigating through SQL Data
MikeKerner at roadrunner.com
Thu Dec 12 17:09:14 EST 2013
Also don't forget that if you get all the data at once, e.g. via
revDataFromQuery, if you have a null last item, LC will pretend it isn't
there b/c LC treats trailing commas like they aren't there.
See "All items are significant, including the last one", and perhaps I have
another convert to addressing this behavior.
On Thu, Dec 12, 2013 at 2:22 PM, Magicgate Software - Skip Kimpel <
skip at magicgate.com> wrote:
> Thanks Pete! I appreciate the input on this.... wasn't quite sure which
> way to go on this.
> On Thu, Dec 12, 2013 at 2:08 PM, Peter Haworth <pete at lcsql.com> wrote:
> > Hi Skip,
> > You might want to think about using revQueryDatabase to create a database
> > cursor. The processing for your buttons then becomes:
> > First: revMoveToFirstRecord
> > Prev: revMoveToPreviousRecord
> > Next: revMoveToNextRecord
> > Last: revMoveToLastRecord
> > It's a bit more longwinded to display the data from your query because
> > 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
> > 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
> > 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.
> > Pete
> > 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
> > > method:
> > > 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:
> > > http://lists.runrev.com/mailman/listinfo/use-livecode
> > >
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
and did a little diving.
And God said, "This is good."
More information about the Use-livecode