Geoff,

Because it gets rid of a bunch of if statements in your repeat loop. It costs you a bit in that the repeat structure is duplicated in the routine that simply counts, so that's a tradeoff. But your repeat ends up being faster because you aren't doing tests each time through.

Further, your code ends up being easier to understand, because one routine simply counts, while one returns data -- more clear.


The function here is to count, and optionally select data from, records that match search criteria. To count and select in separate logic means parsing all records twice.

I did find this logic:

        repeat for each line itemNumber in itemList
          put sdbFieldNumber(itemNumber) into itemNumber

that should be evaluated once all error checks are passed:

        put empty into rawItemNumbers
        repeat for each line itemNumber in itemList
          put sdbFieldNumber(itemNumber)&return after rawItemNumers
        end repeat
        put rawItemNumers into itemList

and removed from the repeat loop...thanks.

Other than that, I don't see much efficiency to be gained here.

Also, if you look closely at "if countOnly" statements, you will find that they are in repeat exit logic, and never get executed more than once.

Rob Cozens
CCW, Serendipity Software Company

"And I, which was two fooles, do so grow three;
Who are a little wise, the best fooles bee."

from "The Triple Foole" by John Donne (1572-1631)

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to