AddThis
Monday, March 27, 2017
Wednesday, March 22, 2017
Multi-select on form datasource grid in AX
There is a difference in iterating the selected records on a form datasource depending on how and what the user has selected.
Suppose we have a form with Grid multi select property = TRUE. The form has button with it clicked method overwritten.
There are three ways to get selected records:
https://msdn.microsoft.com/en-us/library/cc639186.aspx
Here is some sample code:
Suppose we have a form with Grid multi select property = TRUE. The form has button with it clicked method overwritten.
There are three ways to get selected records:
1. Iterating marked records on the grid
Here is some sample code:
void clicked()
{
InventItemGroup itemGroup;
itemGroup = InventItemGroup_DS.getFirst(1);
while (itemGroup.RecId != 0)
{
info(itemGroup.ItemGroupId);
itemGroup = InventItemGroup_DS.getNext();
}
}
2. Getting the current record by just accessing the datasource directly
Here is some sample code:
void clicked()
{
info(InventItemGroup.ItemGroupId);
}
3. Using MultiSelectionHelper class
The MultiSelectionHelper class provides an interface to work with multiple selected records on a form data source.https://msdn.microsoft.com/en-us/library/cc639186.aspx
Here is some sample code:
void clicked()
{
InventItemGroup itemGroup;
MultiSelectionHelper helper = MultiSelectionHelper::construct();
helper.parmDatasource(InventItemGroup_DS);
itemGroup = helper.getFirst();
while (itemGroup.RecId != 0)
{
info(itemGroup.ItemGroupId);
itemGroup = helper.getNext();
}
}
Subscribe to:
Comments (Atom)