如何在 D365FO 的现有量查询中增加字段和数据源(Add the new field or datasource in Inventory On hand form using X++ in D365FO)
我们需要为类 InventDimCtrl_Frm_OnHand 创建一个扩展,以使用方法 modifiedQueryBasedOnDatasourceName 来实现这种Inventory On hand定制。 通过这种方式,我们可以在网格中添加带有过滤选项的新字段。(不使用显示方法)。根据需求,我们可以在表单中添加来自现有数据源以及新数据源的字段。 [ExtensionOf(classStr(InventDimCtrl_Frm_OnHand))] final class InventDimCtrl_Frm_OnHandClass_Extension { public void modifyQueryBasedOnDatasourceName( Query _inventSum_DS_Query, str _inventSum_DS_Name, FormDataSource _inventDim_DS) { Query query; QueryBuildDataSource qbds; QueryBuildDataSource qbdsInventOnHandItemListView; QueryBuildDataSource qbdsInventTable; Counter loop; boolean qbdsExists; next modifyQueryBasedOnDatasourceName(_inventSum_DS_Query, _inventSum_DS_Name, _inventDim_DS); query = _inventSum_DS_Query; qbdsInventTable = query.dataSourceTable(tableNum(InventTable)); if (qbdsInventTable) { qbdsInventTable.addGroupByField(fieldNum(InventTable, BinLocation)); qbdsInventTable.addGroupByField(fieldNum(InventTable, ItemStatus)); …