Reputation: 1581
I want to add another data source in Query prompt.
When I launch a form I open the prompt Query.
In my form init
method I have:
QueryRun queryRun;
super();
queryRun = new QueryRun(TableA_ds.query());
if (! queryRun.prompt())
{
element.close();
}
TableA_ds.query(queryRun.query());
In my Form data source, in init
method, I have put this code to set my query range:
tableA_ds.query().dataSourceTable(tablenum(TableA)).addRange(fieldnum(TableA,FieldtableA)).value(SysQuery::valueUnlimited() );
I want to add another data source (another table) - TableB. I used this code:
purchLine_ds.query().dataSourceTable(tablenum(TableB)).addRange(fieldnum(TableB,FieldtableB)).value(SysQuery::valueUnlimited() );
But when I launch a Form I view only record query range from TableA
Relation of TableA to TableB is on field PurchId
.
I want to see two ranges. Can someone help me?
Thanks for your time.
Enjoy!
Upvotes: 0
Views: 2487
Reputation: 1581
Thanks Alex , for your Help, I used this code, in my Form init Method :
query q = new Query();
QueryBuildDataSource qbds, qbds2;
QueryRun queryRun;
qbds = Q.addDataSource(tableNum(TableA));
qbds.addRange(fieldnum(TableA,Field1TableA)).value(SysQuery::valueUnlimited());
qbds2 = qbds.addDataSource(tableNum(TableB));
qbds2.relations(true);
and launch the query , work well,
enjoy!
Upvotes: 0
Reputation: 78
I think you can add another datasource with: purchLine_ds.query().dataSourcetable(TableA).addDatasource(tablenum(TableB); purchLine_ds.query().dataSourcetable(TableB).relations(true)
Upvotes: 1