Hi all, first of all I want to say this forum is superb: the people here are really willing to help you! Thank you!
I've a question about printing a report. I've created some tables, forms, functions to print pallet labels based on Sales Line records. I can select multiple layouts and send data via a self created form and the request form to the report. So far, this works splendid!
I've created a loop so I can print multiple labels. I use the value of 'quantity' for this: one label per product. To do this, I pass the value to an variable on the request form. But when I send this to the printer, the printer receives multiple individual print jobs. But because this label printer is on a machine and triggered by a specific process, this is not working when it are individual jobs...
Does somebody know whether I can change this: I want to have 1 print job with multiple 'pages', instead of the multiple print jobs. Is this possible?
Extra info: if I set the number of prints on the request form to 1 and in the Printer dialogue for example to 10, I get one jobe with 10 pages.
Thanks in advance!
Answers
What you need to do is to re-desing your report so it can print many records in one go, and instead of firing it in a loop, you'd need to filter required Sales Lines and pass filtered record to the report.
Slawek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
This depends how you call the Report in your code.
For each Sales Order a single print job
One print job for all Sales Orders
Slawek,
The report consist of only one body section. I know how to influence reports with functions like Showoutput, but how do I repeat sections? How do I create a loop in which the body section is run multiple times, based on the value of the integer variable 'Quantity'. Can you help me out a little bit?
But normally you would add another data item based on table Integer, one level below the data item you want to repeat, and move the content of your section into the Integer's body. Then you can simply set a filter on the Integer dataitem table to get required number of repetitions.
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
When I run the report with the button on the form, the right amount of pages is created, with the right content, but the printer is still receiving multiple print jobs... ... Sometimes I have to print only a few labels, then this is not a problem, but most of the times it are 50, 60 or 70 labels and then the printer is stalling: it is printing faster than it is receiving jobs from the queu: the printer stops multiple times and the printing takes much longer than it should...
Am I'm doing something wrong? Or is this just they way it is? Sorry for all the trouble
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Also try changing property NewPagePerRecord to Yes on CopyLoop DataItem and commenting CurrReport.PAGENO=1 line of code
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Also, NewPagePerRecord is set to Yes already and I've the code in the OnAfterGetRecord-section of the Copyloop DataItem.
By the way - if you decided not to define any functions on your reports, and instead you're passing the parameters through a single instance codeunit, rather than repeating 4 times each for different report variable 4 the same lines of code (like this) you could try the construct which, apart from shortening the code, is also a bit different method of invoking printing job. I am not particularly convinced that it would help in this case, but why not try to give it a go.
On the top of that you can try few more things in NAV, playing a bit with the report by changing the paper size/orientation/source in report properties.
You could also try to reset NewPagePerRecord to No on CopyLoop DataItem, and instead add in the CopyLoop one empty body section, after the one with the actual label, and in this new section you can add a line of code CurrReport.NEWPAGE.
You could also instead of adding an extra body section to CopyLoop add another data item based on integer table, one level down below the CopyLoop, set the filters or properties on it to pick only one record, and add the CurrReport.NEWPAGE line in it, in the OnPostDataItem trigger.
You could also try printing to a PDF file, and use shell commands invoked from NAV to print the PDF on your label printer.
You could finally set the label printer to print to a binary file rather than directly to the printer, install a second label printer in your system, share it, and copy the binary file generated by printer 1 to the shared printer using COPY/b generatedprintoutfile.bin \\yourPC\shared printer - invoked from NAV using SHELL or Windows Scripting automation
Slawek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03