repeat & the db funcs

Kay C Lan lan.kc.macmail at gmail.com
Sun Oct 9 21:28:24 EDT 2005


On 10/9/05, Charles Hartman <charles.hartman at conncoll.edu> wrote:
>
> Wouldn't little bits of life be simpler if the 'repeat for each'
> control form could iterate through records in a database cursor?


Yes, I think I could put that to good use.

> I can think of at least five separate ways this might be a dumb
> question (already there, not possible, why not just..., would
> entail..., etc), and I'll bet I'm missing some.
>

In the mean time, a couple of 'why not just...'

If the data is small, say less than 100MB, why not just use the
'revDataFromQuery' function to load all the data into a variable on which
you can then use the 'repeat for each line tMyLine of tMyVarFullOfData'.
This would be much quicker than repeated calls to the database.

If the data is large, why not just use 'revCurrentRecordIsLast' function in
a 'repeat until...' control structure:

repeat until revCurrentRecordIsLast(tMyRecordSetID)
<insert your transcript code here>
revMoveToNextRecord tMyRecordSetID
end repeat

In this last case though, I think your suggestion would be a nice option.

Cheers



More information about the use-livecode mailing list