Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

Getting Errors in DP class

Posted on by 86

Hi  Experts,

I am developing a SSRS report but getting few errors  please correct me where I am wrong. Kindly PFA Code and errors.

[SRSReportParameterAttribute(classstr(ASL_VTS_ChequeRequisitionSlipReportContract))]
class ASL_VTS_ChequeRequisitionSlipReportDP extends SrsReportDataProviderPreProcessTempDB
{
    ASL_VTS_ChequeRequisitionSlip     chequeRequisitionSlip;


    [SRSReportDataSetAttribute(tableStr(ASL_VTS_ChequeRequisitionSlip))]
    
    public ASL_VTS_ChequeRequisitionSlip getchequeRequisitionSlip()
    {
        select * from chequeRequisitionSlip;
        return chequeRequisitionSlip;
    }

    [SysEntryPointAttribute(false)]
    public void processReport()
    {
        Query                             query = this.parmQuery();
        QueryRun                          queryRun;
        ASL_VTS_ChequeRequisitionSlipReportContract  chequeRequisitionSlipReportContract;
        VendTransOpen                      vendTransOpen;
        TransDate                          transDate;
        VendTable                          vendTable;
        VendInvoiceJour                    vendInvoiceJour;
        VendTrans                          vendTrans;
        VendBankAccount                    vendBankAccount;

        transDate = chequeRequisitionSlipReportContract.ParmFromDate();
        transDate = chequeRequisitionSlipReportContract.ParmToDate();

        query.dataSourceTable(tableNum(VendTransOpen)).addRange(fieldNum(VendTransOpen, TransDate)).value(fromDate);

        query.dataSourceTable(tableNum(VendTransOpen)).addRange(fieldNum(VendTransOpen, TransDate)).value(toDate);
        queryRun = new queryRun(query);

        while (queryRun.next())
        {
            vendTransOpen    = queryRun.get(tableNum(VendTransOpen));
            vendTable        = queryRun.get(tableNum(VendTable));
            vendInvoiceJour  = queryRun.get(tableNum(VendInvoiceJour ));
            vendTrans        = queryRun.get(tableNum(VendTrans));
            vendBankAccount  = queryRun.get(tableNum(VendBankAccount));
            ChequeRequisitionSlip.clear();
            ChequeRequisitionSlip.initValue();
            ChequeRequisitionSlip.VendorName    = vendTable.Party;
            ChequeRequisitionSlip.PONumber      = vendInvoiceJour.PurchId;
            ChequeRequisitionSlip.InvoiceNumber = vendTrans.Invoice;
            ChequeRequisitionSlip.BillDate      = vendTransOpen.TransDate;
            ChequeRequisitionSlip.DueDate       = vendTransOpen.DueDate;
            ChequeRequisitionSlip.PaymentAmount = vendTrans.AmountCur;
            ChequeRequisitionSlip.BeneficiaryAccountNumber = vendBankAccount.AccountNum;
            ChequeRequisitionSlip.BeneficiaryBankSwiftCode = vendBankAccount.SWIFTNo;

            ChequeRequisitionSlip.insert();



        }

    }

}
am.png

Regards

  • GirishS Profile Picture
    GirishS 27,832 Super User 2024 Season 1 on at
    RE: Getting Errors in DP class

    Please close this thread and create new one with above issue. Above issue is not related to the heading of your question.

    When the same issue is faced by some of them it will be difficult for them to find this from the community, Since the heading of your thread is different.

    Also please mark the helpful answers as verified so others can make use of it.

    Thanks,

    Girish S.

  • ax.tech Profile Picture
    ax.tech 86 on at
    RE: Getting Errors in DP class

    Hi Girish,

    Now report is working fine but another requirement is I have to add another 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

    ui.png

  • GirishS Profile Picture
    GirishS 27,832 Super User 2024 Season 1 on at
    RE: Getting Errors in DP class

    Your AOT query is totally wrong. First you need to understand how to create AOT query.

    From the screenshot you have added VendInvoiceJour table under VendTransOpen DataSource. But you have added relation to VendTable.

    Please correct that query and check.

    Thanks,

    Girish S.

  • Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,605 Super User 2024 Season 1 on at
    RE: Getting Errors in DP class

    Your complete dp class's working will depend on that query. As Girish suggested there is no relationship between VendTable and VendBankAccount.

    So when running the report, are you able to get Records to include drop-down? So when you click on that filter button you should be able to get that range of Invoice number in the frontend. Is that coming? If not you have forgot to add range in the query and you need to add that. Also before making all these changes first create a runnable job and check if the query is working. So in this job also you need to get the query prompt.

    As I said earlier please check this query in ssms. Using inner join means first you need to check the table level relations from standard table and based on the cardinality defined there you need to give the joins as inner or outer.

    If you are getting the data in ssms and the runnable job  (while debugging you can hover on table buffer) then you need to make those changes in dp class accordingly. Please let me know once these changes are done and it's working status.

  • ax.tech Profile Picture
    ax.tech 86 on at
    RE: Getting Errors in DP class

    Added the relation between both the tables and  after commenting the ranges report is still empty.

    Regards

  • GirishS Profile Picture
    GirishS 27,832 Super User 2024 Season 1 on at
    RE: Getting Errors in DP class

    Where is the relation between VendTable and VendBankAccount table?

    Relation seems to be empty from the screenshot.

    First check whether the query is correct. To check that comment all the ranges you have added in the dp class. Like from date - to date and invoice id - Check whether reports show data after commenting the ranges.

    Thanks,

    Girish S.

  • ax.tech Profile Picture
    ax.tech 86 on at
    RE: Getting Errors in DP class

    Hi Girish,

    Done as you said but still data is not coming. Kindly PFA screenshot.

    3324.pl.png

    Regards

  • ax.tech Profile Picture
    ax.tech 86 on at
    RE: Getting Errors in DP class

    [
    DataContractAttribute
    //SysOperationGroupAttribute('Date', "@SYS7402", '1')
    ]
    
        class ASL_VTS_ChequeRequisitionSlipReportContract
    {
    
        TransDate       FromDate;
        TransDate       ToDate;
        //////////////////////////////////////
    
    
        
            [
        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;
    
        }
    
        ////////
    
    }
    
    [
    SRSReportQueryAttribute(queryStr(ASL_VTS_ChequeRequisitionSlipReport)),
        SRSReportParameterAttribute(classstr(ASL_VTS_ChequeRequisitionSlipReportContract))
    ]
    class ASL_VTS_ChequeRequisitionSlipReportDP extends SrsReportDataProviderPreProcessTempDB
    {
        ASL_VTS_ChequeRequisitionSlip     chequeRequisitionSlip;
    
    
        [SRSReportDataSetAttribute(tableStr(ASL_VTS_ChequeRequisitionSlip))]
        public ASL_VTS_ChequeRequisitionSlip getchequeRequisitionSlip()
        {
            select * from chequeRequisitionSlip;
            return chequeRequisitionSlip;
        }
    
        [SysEntryPointAttribute(true)]
        public void processReport()
        {
            Query                             query = this.parmQuery();
            QueryRun                          queryRun;
            ASL_VTS_ChequeRequisitionSlipReportContract  chequeRequisitionSlipReportContract;
            VendTransOpen                      vendTransOpen;
            TransDate                          transDate;
            VendTable                          vendTable;
            VendInvoiceJour                    vendInvoiceJour;
            VendTrans                          vendTrans;
            VendBankAccount                    vendBankAccount;
            FromDate                           fromDate;
            ToDate                             toDate;
            
            //get contract class instance.
            chequeRequisitionSlipReportContract = this.parmDataContract() as ASL_VTS_ChequeRequisitionSlipReportContract;
            fromDate = chequeRequisitionSlipReportContract.parmFromDate();
            toDate = chequeRequisitionSlipReportContract.parmToDate();
    
            query.dataSourceTable(tableNum(VendTransOpen)).addRange(fieldNum(VendTransOpen, TransDate)).value(queryRange(fromDate,toDate));
    
            //query.dataSourceTable(tableNum(VendTransOpen)).addRange(fieldNum(VendTransOpen, TransDate)).value(toDate);
            queryRun = new queryRun(query);
    
            while (queryRun.next())
            {
                vendTransOpen    = queryRun.get(tableNum(VendTransOpen));
                vendTable        = queryRun.get(tableNum(VendTable));
                vendInvoiceJour  = queryRun.get(tableNum(VendInvoiceJour ));
                vendTrans        = queryRun.get(tableNum(VendTrans));
                vendBankAccount  = queryRun.get(tableNum(VendBankAccount));
                chequeRequisitionSlip.clear();
                chequeRequisitionSlip.initValue();
                chequeRequisitionSlip.VendorName    = vendTable.Party;
                chequeRequisitionSlip.PONumber      = vendInvoiceJour.PurchId;
                chequeRequisitionSlip.InvoiceNumber = vendTrans.Invoice;
                chequeRequisitionSlip.BillDate      = vendTransOpen.TransDate;
                chequeRequisitionSlip.DueDate       = vendTransOpen.DueDate;
                chequeRequisitionSlip.PaymentAmount = vendTrans.AmountCur;
                chequeRequisitionSlip.BeneficiaryAccountNumber = vendBankAccount.AccountNum;
                chequeRequisitionSlip.BeneficiaryBankSwiftCode = vendBankAccount.SWIFTNo;
    
                chequeRequisitionSlip.insert();
    
    
    
            }
    
        }
    
    }

    Hi Bharani Preetham Peraka,

    Thanks for replying. Requirement is I have to build a report in which I have to  show VendorName,PONumber,InvoiceNumber,BillDate,DueDate,PaymentAmount,BeneficiaryAccountNumber and BeneficiaryBankSwiftCode on the basis of "from date" "to date" and "invoice number". Kindly PFA my Contract and data provider class and please correct my query. In have made relations as mentioned in above image and i am using inner join. Please correct me where I am wrong.

    Regards

  • GirishS Profile Picture
    GirishS 27,832 Super User 2024 Season 1 on at
    RE: Getting Errors in DP class

    Your query seems to be wrong, I guess. VendTransOpen table has relation with VendInvoiceJour, VendTrans, VendTable. So as per the relations query should be like below.

    VendTransOpen >> Add all the 3 tables( VendInvoiceJour, VendTrans, VendTable) inside the DataSource of VendTransOpen. For each relation refer to VendTransOpen  table.

    4th table VendBankAccount should be inside the DataSource of VendTable and add for relations refer to VendTable.

    Thanks,

    Girish S.

  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,605 Super User 2024 Season 1 on at
    RE: Getting Errors in DP class

    If data is not coming means your query is wrong. Can you check if all the relations and joins are correct in the query? Also add this query in a job and run it. Then using debugger check if data is returning by the query. Also you can do the same by writing a select Statement in the SSMS. If data is coming and you are able to see, then please let us know what have you done in the report completely starting from contract classes and what is your exact requirement.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans