FXResetPageTotal docoid up

[Please reference this post if you have not previously read about VFP-TMM.]

I decided to reward myself with a little fun after working on the FXListener monster today… so I am pleased and proud to be introducing FX Group Reset PageTotal Implementation to you tonight. This little class is so simple that the blog post I’m writing right now may be longer than the docoid.  It’s so useful that it was literally the first reportlistener extension I ever wrote.

FXResetPageTotal is a VFP 9 Reporting System-specific implementation of the Reset-On-Group pagination scenario.  This one is a classic for reporting engines, and I’ve discussed in a Reporting Services context elsewhere in this blog.

I wrote it fairly early during the RTM cycle, as soon as we realized that we could make TwoPassProcess readwrite. It was clear that Xbase code was going to be a lot more efficient at keeping track of multiple page numbers by group, considering the possibility of thousands of groups, than native code would be. (It uses a smartly-indexed cursor in the FRXDataSession, natch.)

There was no way we were going to find a way to get _PAGETOTAL to be less dumb than it is, and we knew this was something people would really want to do.

Whoa, wait a second.  Did I just say “during the RTM cycle”?  You bet.  The code in fxResetPageTotal, which is pretty sweet and actually pretty hard to figure out, was written originally as a reportlistener implementation.

Towards the end of the RTM cycle, when I was working out the FX subsystem idea and putting it into the RTM docs, I turned it into an FX object in less than an hour.  All the hard work had already been done, and I barely had to change a line of code.

I hope that makes you look at your own reportlistener extensions with a new perspective.  Which ones are really output-generating, and which are decorations for output?  You can turn the second group into FX and GFX objects with very, very little work. You can share them and mix and match for reporting needs much easier than you could do the same thing with monolithic reportlisteners.  You can have all the benefits of multiple inheritance without the feeling that you need to decontaminate yourself afterwards.

Go on and give it a try.