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();}
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.
Ok thanks, but look, my code looks like this but parmShowDialog(false); doesnt work, i still get the dialog, why ??? i need to disable it
ProdJournalBOM reportRecord; ProdPickListController controller = new ProdPickListController(); SRSPrintDestinationSettings settings; Args args2 = new Args();
controller.parmReportName(ssrsReportStr(ProdPickList, Report)); controller.parmShowDialog(false); select firstOnly * from reportRecord where reportRecord.ProdId == salesParmLine2.salesLine().InventRefId; args2.record(reportRecord); controller.parmArgs(args2); controller.startOperation();
That's a different question, therefore the right approach to use this forum is marking this thread as answered and creating a new thread for the new question, with the appropriate title and tags (including the version, which you again forget to mention).