Link datasources outside datasource methods?

Is is possible to link datasources in a form method instead of the datasource methods?

This is how I link them inside the datasource init method…FYI

///////////////2nd datasource init

QueryBuildDatasource queryBuildDatasource;



inventtable_ds.linkType(3); // IS THERE A ENUM FOR THAT?


queryBuildDatasource = this.query().dataSourceNo(2);


You surely can call such code from other places, but I’m not sure it will have any affect. Before init(), inventtable_ds doesn’t exist. After init(), the query is already built.

What I do is manipulating the actual query (QueryBuildDataSource instances), not datasource definitions.

Can you change the QueryBuildDataSource links in the instance and have the right result in a grid?

I have tried but coudn’t make it work properly.

Yes, you can manipulate the query in almost any way - adding ranges, adding datasources, disabling datasources, changing join mode etc. Then you have to run the query.

It’s often implemented directly in executeQuery() above super().

You can find many examples in the standard code base (just use cross-references). For example, look at updateLinks() method in PurchRFQCaseTable form in AX2009/2012.