Passing queries between classes and forms

I created a class, ProcessInventData, that extends RunBaseBatch and created a custom form for the dialog (similar to \Forms\tutorial_RunbaseForm). When running the RunBaseBatch class, the dialog (I'll refer to as Form A) comes up which the user can provide parameters and also customize the query via the Select button. I also have another button that launches yet another form in which I pass the current query.

The new form (I'll refer to as Form B) has a datasource that is the same type that is contained in the query that is passed. The grid displays the data filtered based on what the original query was setup as in the original dialog (Form A). This is done via the following command in the Init() method of the data source:


All is well so far. However, the issue starts to occur when I add another Data Source to Form B, such as Inventory Dimensions. Once I set that datasource to inner join on the primary data source, I get the following error:

The data source name InventDimTableA is already used. Each data source name must be unique in the query.

There is no pre-exisiting Data Source with the same name in Form A, Form B or the original RunBaseBatch class. Strange indeed.

I have tried to unset the Join type for the InventDim datasource in Form B and do all the query manipulation in the RunBaseBatch class, hoping that the query will be carried over, but it is not, even if I override the Init() method in the InventDim datasource using the same this.query(ProcessInventData.queryRun().query()); call.

Eventually I would like to add additional tables to the query in my RunBaseBatch class's initQuery();

Any answers and insight are greatly appreciated!