fredag den 26. august 2011

RunBaseBatch inheritance and saving last values chosen in a query

Today I found a little hack that is useful.
I have a (super) class extending RunBaseBatch.
This class build a query on the fly.
This class also implements a dialog, which of course have a select button, so you can input search ranges for the query the class uses.

I have a second (sub) class extending the first (super) class.
Of course the sub-class also uses a query object.

The problem was that when the super class and the sub class instatiates a query on the fly the query is nameless, and therefor execution of the dialog for the query ranges, resulted in the savelast values for the query to become messed up, so that when you ran the sub-class you would get the query ranges from the super-class and vice versa.

A simple solution exists to this problem:
When you instatiate the query object in the and then the queryRun object, you can do:;

giving the queryRun object the name of the object instatiated using the super- or subclass.
This seems to keep the query ranges sys last values separate for the two classes.

Ingen kommentarer:

Send en kommentar