Hi All,
In this blog we will learn how to get all selected records from form grid or form datasource in event handler.
X++ code.
[FormControlEventHandler(formControlStr(LedgerJournalTransCustPaym, UpdateOffsetDimension), FormControlEventType::Clicked)]
public static void UpdateOffsetDimension_OnClicked(FormControl sender, FormControlEventArgs e)
{
FormRun formRun = sender.formRun();
FormDataSource ledgerJournalTrans_ds;
LedgerJournalTrans ledgerJournalTrans;
ledgerJournalTrans_ds = formRun.dataSource(tableStr(LedgerJournalTrans));
MultiSelectionHelper selectionHelper = MultiSelectionHelper::construct();
selectionHelper.parmDataSource(ledgerJournalTrans_ds);
ledgerJournalTrans = selectionHelper.getFirst();
while (ledgerJournalTrans)
{
info(ledgerJournalTrans.Voucher);
ledgerJournalTrans = selectionHelper.getNext();
}
}
Thank you for your great contribution and if I only want all the records of the grid, since it is disabled to be able to select several
ReplyDelete