Adding view/temporary table records to Form Grid

2019-07-28 07:24发布

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?

1条回答
我欲成王,谁敢阻挡
2楼-- · 2019-07-28 08:00

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));
}
查看更多
登录 后发表回答