Reputation: 323
I am dynamically creating a form through x++. I want to represent a datasource into 2 or more grids, depending on the number of instances of a certain field. Am looking for something like the one below but am able to use different instances of the datasource, defined by a range query or some sort.
formString = formBuildGridControl.addDataField(formBuildDatasource.id(), fieldNum(SomeTable, SomeField));
I also have these codes:
fds = formRun.dataSource();
qbds = fds.query().dataSourceTable(TableNum(SomeTable));
qbr = Qbds.addRange(fieldnum(SomeTable, SomeField));
qbr.value(SomeValue);
However it affects all the grids. Is there something I can use to define each grids differently where the above code has a different SomeValue
for each grid?
Upvotes: 1
Views: 2843
Reputation: 18051
A single datasource cannot have different filters or ranges in two grids.
You will most likely need to drag your table twice to make two datasources, then apply the different filters in the init
or executeQuery
methods of the datasources. Remember to change the datasource
attribute of the grids to match the correct one.
void init()
{
super();
this.queryBuildDatasource().addRange(fieldnum(SomeTable, SomeField)).value(queryValue(SomeValue));
}
Upvotes: 1