Hi all,
I have two reports running, one right after the other. The first one shows a request window, but the second does not. The point of that is for the user to print a check and the stub details will print afterwards. They do not want to see two request windows.
Everything works just fine until I cancel the print in the request window. The check cancels but the second report continues to print. I don't understand how to set a flag to find out if the first report ran or not. I feel like I'm missing something simple here.
Any thoughts are appreciated.
Dneal
0
Comments
If in the first report create a global var. If the report is printed then set the global var as true. The code should only print the second report if the var is true.
Freelance Dynamics AX
Blog : http://axnmaia.wordpress.com/
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book
Thanks for your responses.
How do I check if the first report ran?
I put the code for the second report in the Document-Print codeunit-229, in the PrintCheck function. I put it right after the first report that prints.
Am I doing this correctly?
Thank you,
Dneal
GenJnlLine.COPY(NewGenJnlLine);
ReportSelection.SETRANGE(Usage,ReportSelection.Usage::"B.Check");
ReportSelection.SETFILTER("Report ID",'<>0');
ReportSelection.FIND('-');
REPEAT
REPORT.RUNMODAL(ReportSelection."Report ID",TRUE,FALSE,GenJnlLine);
UNTIL ReportSelection.NEXT = 0;
//MY CODE
ReportSelection.RESET;
ReportSelection.SETRANGE(Usage,ReportSelection.Usage::"B.CheckStub");
ReportSelection.SETFILTER("Report ID",'<>0');
ReportSelection.FIND('-');
REPEAT
REPORT.RUNMODAL(ReportSelection."Report ID",FALSE,FALSE,GenJnlLine);
UNTIL ReportSelection.NEXT = 0;
//MY CODE
For example after the report had run, it sets himselft a var to show that has printed.
You can see an example in the Posted Invoices Reports. Every time you print a report of that type, the number of printed increase. So you must do a similar thing to with report do you want to check if was printed.
There isn't a generic way to see if a report was printed.
Freelance Dynamics AX
Blog : http://axnmaia.wordpress.com/
If the user closes the report before, then you have to set some global var to tell it not to run the second report in the PostReport trigger.
D365 Business Central Solutions Architect
BC AL/NAV C/AL Developer
BC Repositories.com
That's what I have done, works perfectly!
Thanks all for the help.
Dneal