Skip to main content

Pass values between form and report

How to pass values between form and report

Here is for example the code of the button that calls the report:

void clicked ()
{
    Args     args;
    ReportRun          reportRun;
    ;
    super();
    args = new Args();
    args.name(Reportstr(HistoryHolidays));
    args.parm( LogId  );
    reportRun = classfactory.reportRunClass(args);
    reportRun.init();
    reportRun.run();
    reportRun.wait();
    args.parmObject( args );
}

in the init method of your report try this:

public void init()
{
    if( element.args() )
    {
        logId =  element.args().parm();
    }
     super();
}

then you can use this parameter in your report form example: 

public void executeSection()
{
    ;
    if  ( employee_1.LogId == logId)
    {
        emplId = employee_1.empId;
        super();
    }
    if ( logid == "1")
    {
        emplId = DropHoliday_1.EmpId;
        super();
    }
}

You can use this logic in your code for many purpose.

Comments

Popular posts from this blog

D365 : ENABLE AND DISABLE IN LIST PAGE

 here i have added 4 button in salesQuotationlistpage. now i need to enable/disable button according status. so i have Extensionof  of class SalesQuotationListPageInteraction and modify setButtonEnabled method by Chain of Command //list page button enable and diable in listpage interation class [ExtensionOf(classStr(SalesQuotationListPageInteraction))] final class SQTableinimathod_Extension {     protected void setButtonEnabled()     {                SalesQuotationTable SalesQuotationTable;         CustQuotationJour   CustQuotationJour;         CustQuotationConfirmJour  CustQuotationConfirmJour;               next setButtonEnabled();         SalesQuotationTable SalesQuotationTable1 = this.listPage().activeRecord(queryDataSourceStr(SalesQuotationListPage, SalesQuotationTable));         selec...

An error occurred during report data sets execution D365 For finance and operations

  Hi all, small tip. I faced this issue, when I extend the custom report in D365 for finance and operations. During development on onebox     Solution was simple, restart IIS services Restart Reporting Services. Happy Daxing.

CODE TO PDF IN AX 2012

static void Job1(Args _args) {         PurchPackingSlipController      ssrsController = new SrsReportRunController();         TradeDocumentReportContract     purchPackingSlipContract = new TradeDocumentReportContract();         SRSPrintDestinationSettings     printerSettings;         VendPackingSlipJour             VendPackingSlipJour;         Args                            args;         //select the latest record based on create date         while select VendPackingSlipJour             order by VendPackingSlipJour.createdDateTime DESC             where VendPackingSlipJour.PackingSlipId == 'LJ-01'         ...