Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

How to reflect report based on Invoice Number

(0) ShareShare
ReportReport
Posted on by 86

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

2465.ui.png

  • ax.tech Profile Picture
    86 on at
    RE: How to reflect report based on Invoice Number

    Thanks you so much Girish it is working fine now.

  • Verified answer
    GirishS Profile Picture
    27,823 Moderator on at
    RE: How to reflect report based on Invoice Number

    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,

    Girish S.

  • ax.tech Profile Picture
    86 on at
    RE: How to reflect report based on Invoice Number

    Hi Girish,

    Got this error now. Kindly PFA screenshot.

    gbg.png

    Regards

  • Verified answer
    GirishS Profile Picture
    27,823 Moderator on at
    RE: How to reflect report based on Invoice Number

    MultiSelectionHelper class is in Application common model - So you need to refer that model also.

    Thanks,

    Girish S.

  • ax.tech Profile Picture
    86 on at
    RE: How to reflect report based on Invoice Number

    Hi Girish,

    Thanks for replying. I am getting error in controller class. Kindly PFA contract class, controller class and error screenshot.  

    nh.png

    [
    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);
        }
    
    }

    Regards

  • Suggested answer
    GirishS Profile Picture
    27,823 Moderator on at
    RE: How to reflect report based on Invoice Number

    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.

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.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,238 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,923 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans