Announcements
No record found.
hi all!how can I pass a form DataSource to a class because it gives me an error of the tablename_ds is not declared?
[FormControlEventHandler(formControlStr(RetailTransactionTable, RetailReport_Transaction), FormControlEventType::Clicked)] public static void RetailReport_Transaction_OnClicked(FormControl sender, FormControlEventArgs e) { MultiSelectionHelper selectionHelper = MultiSelectionHelper::construct(); RetailTransactionTable retailTransactionTable; str transId; selectionHelper.parmDataSource(TableName_ds); retailTransactionTable1 = selectionHelper.getFirst(); transId = retailTransactionTable.transactionId; }
Hi, You need to initialize FormDatasource buffer. Try adding below code at Line#9
FormDatasource TableName_ds = sender.formrun().datasource(IdentifierStr(Tablename));
Replace TableName with name of Datasource name.
If you are writing COC then you can use directly the variables and DataSource names - If you are using event handlers you need to get form run and then get the datasource from form run.
[FormControlEventHandler(formControlStr(RetailTransactionTable, RetailReport_Transaction), FormControlEventType::Clicked)] public static void RetailReport_Transaction_OnClicked(FormControl sender, FormControlEventArgs e) { MultiSelectionHelper selectionHelper = MultiSelectionHelper::construct(); RetailTransactionTable retailTransactionTable; str transId; //get the form run FormRun frun = sender.formRun(); FormDataSource fds = frun.datasource(formDataSourceStr(FormName,DataSourceName)); selectionHelper.parmDataSource(fds); retailTransactionTable1 = selectionHelper.getFirst(); if(retailTransactionTable1) { //do some process transId = retailTransactionTable.transactionId; retailTransactionTable1 = selectionHelper.getNext() } }
Thanks,
Girish S.
hi when i try your line i recieved this error when trying to run the form
Have you debugged the code?
Find out in which line the error is throwing.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Giorgio Bonacorsi 733
André Arnaud de Cal... 461 Super User 2026 Season 1
Syed Haris Shah 278 Super User 2026 Season 1