Old Dog, New Tricks

Doing lots of POLP these days - plain old LotusScript programming. And some things are coming back to me now. An intereresting idea I had the other day - in the midst of smoke coming from my lungs, ears, fingers and nether regions.. All through various bits of code is the idea of a counter. So at the end you can say "Gee, I had 1,323 documents, 434 of type Memo, and 42 of type "Foobar", and of which 32 were bad", etc, etc. All very tedious.

So why not in your application do this:

    dim Counters LIST as Long

And then all through your code do:

  : Call IncrementCounter("Total Documents")


sub incrementCounter(marker as String)

  If not isElement(Counters(marker)) then

    Counters(marker) = 1


    Counters(marker) = Counters(marker) + 1

  end if

end sub.

And at the end:

forall thisCounter in Counters

  Print "Counter: " + lsittag(thisCounter) + " = " + cstr(thisCounter)

end forall

Easy, eh ? And since each counter is referenced by a descriptive marker string, you can litter your code with as many counters as you like?

Okay. Its just a snippet. Not even a SNTT.. But hey.. Its Wednesday.