Running report from code

Hi,

im running report from code and gets stuck or wait too long becouse it tries to print all the records of production picking list - i need to print particular production picking list from code, it prints it all, where am i doing a mistake ???

static void Job27(Args _args)
{
        ProdJournalBOM                          reportRecord;
        SrsReportRunController             controller = new SrsReportRunController();
        SRSPrintDestinationSettings     settings;
        Args                                                 args = new Args();

        controller.parmReportName(ssrsReportStr(ProdPickList, Report));
        controller.parmExecutionMode(SysOperationExecutionMode::Synchronous);
        //  controller.parmShowDialog(false);

        select firstOnly * from reportRecord where reportRecord.ProdId == 'W049763';

        args.record(reportRecord);
       // args.parmEnum(PrintCopyOriginal::Original);
       // args.parmEnumType(enumNum(PrintCopyOriginal));

        controller.parmArgs(args);

        settings = controller.parmReportContract().parmPrintSettings();
        settings.printMediumType(SRSPrintMediumType::Screen);
        controller.startOperation();
}

Parents
  • What you need to do is to add a range to the query used the report. In this particular case, the logic for adding the range for the given ProdJournalBOM record already exists, but you're using a wrong controller. SrsReportRunController class has no special handling for ProdJournalBOM records, but ProdPickListController class does have (in its initFromArgs() method).

    By the way, don't forget to attach a version tag (e.g. AX 2012) when creating a new thread. Which version we're talking about is often a crucial piece of information.

Reply Children
Related
Recommended