Thursday, August 11, 2016

Running the report via code Without controller

//Running the report via code WO controller

static void ReportRunCheck(Args _args)
{
    SrsReportRunController      reportRunController;
    Map                         queryContracts;
    MapEnumerator               mapEnum;
    Query                       query;
    QueryBuildRange             range;
    SrsReportDataContract       contract;
    FCCPaySlipContract   rdpContract;
    FilePath                    outputPath = "c:\\";
    ;
    reportRunController = new SrsReportRunController();
    reportRunController.parmReportName('FCCPAYLIP.Report');
    reportRunController.parmLoadFromSysLastValue(false);
   
    contract    = reportRunController.parmReportContract();
    contract.parmPrintSettings().printMediumType(SRSPrintMediumType::File);
    contract.parmPrintSettings().overwriteFile(true);
    contract.parmPrintSettings().fileFormat(SRSReportFileFormat::XML);
    contract.parmPrintSettings().fileName(outputPath + "Payslip.xml");
  
    rdpContract = contract.parmRdpContract() as FCCPaySlipContract;
    rdpContract.parmEmployeeId("2005");
    rdpContract.parmPayMonth(mkDate(01,06,2016));   
   
    //queryContracts = contract.parmQueryContracts();
    //mapEnum = queryContracts.getEnumerator();
    //while(mapEnum.moveNext())
    //{
        //query = mapEnum.currentValue();
        //range = SysQuery::findOrCreateRange(query.dataSourceTable(tableNum(VendTable)),fieldNum(VendTable,AccountNum));
        //range.value('3*');
    //}
   
    reportRunController.runReport();
}

No comments:

Post a Comment

Convert Call stack to readable format in D365FO X++

//Input --container _xppCallStack = xSession::xppCallStack();  Public static str POL_formatXppCallStack(container _xppCallStack, int _skipFr...