Interview Questions

Monday, May 12, 2014

X++ code to identify multiple selected records in Grid

Steps :
1. Create a new method on form and copy the following code.
2. Next create a button on form . and call the method on the button click event. 
(for the button property makesure the Multiselect should be set to yes , or else by default for multiple selection system will disable the buttons)

void checkSelectedRecords()
{
InventTable inventLocal;
;
//getFirst method gets all the selected records in the grid
inventLocal = InventTable_ds.getFirst(true);

while (inventLocal)
{
info(strfmt("You selected Item %1",inventLocal.ItemId));
// get the next selected record
inventLocal = InventTable_ds.getNext(); 
}
}

As shown below ..

No comments:

Post a Comment