Notifications
Announcements
No record found.
Hi Experts,
Requirement is I have to add parameter invoice number and in a open vendor invoices form if a user select N number of invoices and click generate report button this report will open based on the invoices selected by the user. How can I do that please help. Kindly PFA screenshot.
Regards
Hi ax.tech,
You need to create a List type parameter in the contract class. Now in the report controller class you need to get the caller record and form datasource. After getting the form datasource you can loop through the selected records using MultiSelectHelperClass and insert into list.
Add the above logic in prePromptModifyContract method of controller class.
Controller class.
Public class YourCOntrollerClassName { public static void main(Args _args) { //add your code to call the report along with passing args. this.parmArgs(_args); } protected void prePromptModifyContract() { YourContracClassName contract = this.parmReportContract().parmRdpContract() as YourContracClassName; TableName tableName = this.parmArgs().record() as TableName; TableName tableName1; List list = new List(Types::String); FormDataSource fds = FormDataUtil::getFormDataSource(tableName); MultiSelectionHelper helper = MultiSelectionHelper::construct(); helper.parmDatasource(tableName); tableName1 = helper.getFirst(); while (tableName1.RecId != 0) { //inside the loop insert only invoice id to list list.addStart(tableName1.InvoiceId); tableName1 = helper.getNext(); } //now pass the list values to contract class contract.parmInvoiceIdList(list); } } }
In the dp class you can add a range to InvoiceId. Loop through the list using enumerator and add range to it.
Thanks,
Girish S.
Hi Girish,
Thanks for replying. I am getting error in controller class. Kindly PFA contract class, controller class and error screenshot.
[ DataContractAttribute //SysOperationGroupAttribute('Date', "@SYS7402", '1') ] class ASL_VTS_ChequeRequisitionSlipReportContract { TransDate FromDate; TransDate ToDate; List InvoiceId; ////////////////////////////////////// [ DataMemberAttribute('FromDate'), SysOperationLabelAttribute('From Date'), SysOperationDisplayOrderAttribute('1') ] public TransDate ParmFromDate(TransDate _FromDate = FromDate) { FromDate = _FromDate; return FromDate; } //////////////////////////////////////////// [ DataMemberAttribute('ToDate'), SysOperationLabelAttribute('To Date'), SysOperationDisplayOrderAttribute('2') ] public TransDate ParmToDate(TransDate _toDate=toDate) { toDate = _toDate; return toDate; } //////// [ DataMemberAttribute('InvoiceNumber'), SysOperationLabelAttribute('Invoice Number'), SysOperationDisplayOrderAttribute('3') ] public List ParmInvoiceId(List _invoiceId=invoiceId) { invoiceId = _invoiceId; return invoiceId; } } Public class ASL_VTS_ChequeRequisitionSlipController extends SrsReportRunController { public void main(Args _args) { //add your code to call the report along with passing args. this.parmArgs(_args); } protected void prePromptModifyContract() { ASL_VTS_ChequeRequisitionSlipReportContract contract = this.parmReportContract().parmRdpContract() as ASL_VTS_ChequeRequisitionSlipReportContract; ASL_VTS_ChequeRequisitionSlip chequeRequisitionSlip = this.parmArgs().record() as ASL_VTS_ChequeRequisitionSlip; VendTrans vendTrans; List list = new List(Types::String); FormDataSource fds = FormDataUtil::getFormDataSource(chequeRequisitionSlip); MultiSelectionHelper helper = MultiSelectionHelper::construct(); helper.parmDatasource(chequeRequisitionSlip); vendTrans = helper.getFirst(); while (vendTrans.RecId!=0) { //inside the loop insert only invoice id to list list.addStart(vendTrans.Invoice); vendTrans = helper.getNext(); } //now pass the list values to contract class contract.parmInvoiceId(list); } }
MultiSelectionHelper class is in Application common model - So you need to refer that model also.
Got this error now. Kindly PFA screenshot.
I have added the code wrongly. It must be helper.parmDatasource(fds);
You need to pass the FormDataSource object. Also, you have declared buffer for VendTrans table. But your formdataSource is ASL_VTS_ChequeRequisitionSlip.
protected void prePromptModifyContract() { ASL_VTS_ChequeRequisitionSlipReportContract contract = this.parmReportContract().parmRdpContract() as ASL_VTS_ChequeRequisitionSlipReportContract; ASL_VTS_ChequeRequisitionSlip chequeRequisitionSlip = this.parmArgs().record() as ASL_VTS_ChequeRequisitionSlip; ASL_VTS_ChequeRequisitionSlip vendTrans; List list = new List(Types::String); FormDataSource fds = FormDataUtil::getFormDataSource(chequeRequisitionSlip); MultiSelectionHelper helper = MultiSelectionHelper::construct(); helper.parmDatasource(chequeRequisitionSlip); vendTrans = helper.getFirst(); while (vendTrans.RecId!=0) { //inside the loop insert only invoice id to list list.addStart(vendTrans.Invoice); vendTrans = helper.getNext(); } //now pass the list values to contract class contract.parmInvoiceId(list); }
Thanks you so much Girish it is working fine now.
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
André Arnaud de Cal... 449 Super User 2025 Season 2
Martin Dráb 422 Most Valuable Professional
BillurSamdancioglu 239 Most Valuable Professional