Hi guys, Today we see how to get selected records from the grid in Ax 2012 using X++.
write below code in the clicked method.
void clicked()
{
CustomerTable customerTableLoc;
CustomerTable_DS.Anymarked();// check user selected the record or not.
for (customerTableLoc= getFirstSelection(CustomerTable_DS);customerTableLoc;customerTableLoc=CustomerTable_DS.getNext())
{
if (customerTableLoc.recid)
{
info(customerTableLoc.CustAccount);
}
}
}
-------------------------------------------Or-------------------------------------------------
CustomerTable customerTableLoc;
MultiSelectionHelper helper = MultiSelectionHelper::construct();
helper.parmDatasource(CustomerTable_DS);
customerTableLoc = helper.getFirst();
while (customerTableLoc.RecId)
{
info(customerTableLoc.CustAccount);
customerTableLoc = helper.getNext();
Result:
Keep Daxing!!
No comments:
Post a Comment