Hi All,
We have two custom fields on 'InventTable' for 'Manufacturer' and 'Manufacturer ID'. Our goal is to add these two fields to the grid on On-Hand List form. Since 'InventTable_DS' is already a data source on the form, I've added the two fields to the grid, and based on the following posts, added the fields to the query as 'group by' fields.
The suggestion in this post was to add the fields as 'group by' fields:
In this and other posts I've seen, this was done through a Coc code extension on InventDimCtrl_Frm_OnhandItem:
I've followed the above suggestions and created a code extension to add the fields to the form query:
[ExtensionOf(classStr(InventDimCtrl_Frm_OnhandItem))]
final class InventDimCtrl_Frm_OnhandItem_CS_Extension
{
public void modifyQuery(
FormDataSource _inventSum_DS,
FormDataSource _inventDim_DS)
{
next modifyQuery(_inventSum_DS, _inventDim_DS);
Query inventSumQuery = _inventSum_DS.query();
QueryBuildDataSource inventTable_qbds = inventSumQuery.dataSourceTable(tableNum(InventTable));
if (inventTable_qbds)
{
inventTable_qbds.addGroupByField(fieldNum(InventTable, CS_Manufacturer));
inventTable_qbds.addGroupByField(fieldNum(InventTable, CS_ManufacturerItemId));
}
}
}
When the form loads, the new columns for 'Manufacturer' and 'Manufacturer ID' are populated and have the correct values in them. The issue is this; If any filters are applied on the grid, or column sorted/filtered, then the value in the two columns goes blank. For example, hitting 'Apply' in the filters pane causes the values to go blank, but they return on hitting 'Reset.'
If I add 'Manufacturer' and 'Manufacturer ID' to the filter pane, and 'Apply' it still causes the fields to go blank. Oddly, filtering on a value in these filter pane fields gets the correct records, the columns are just visually blank in the grid.
I'm assuming that applying any filters to the grid is removing the fields I've added, but I'm not sure where exactly. There must be another method I need to extend, but it is not mentioned in other posts about extending the On-Hand List that I've found.
I took a trace of hitting 'Apply' and a trace for 'Reset' in the filter pane, and both traces show the same call to my custom code. And both queries from the trace get the same results when I run them in SQL.
If anyone has any experience with extending this form, any help would be greatly appreciated. Thanks!