We have a report that calls another report, and we want to have the second report use the same printer that was selected for the 'main' report. So the user selects a printer for report 1, and then for report 2 it should automatically use the same printer. Does anyone have a tip on how to do this?
0
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
A variable to hold the Printer Name in a textbox, tablerelation to Printer, form 356 Printers (at least in my US vers)
Have them do the lookup, select a printer, and on the button that is firing off the reports init and insert records for that user and report ID in the printer selections then after the reports run delete those records. Get what I'm trying to say?
Should be able to get the Report ID from OBJECTID... Let me know what you come up with; this may look ugly and all but it would probably work? :-k
-Lavin
"Profanity is the one language all programmers know best."
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Is there anyone out who actually got it to work?
In Document-Print for sales delete any existing System Created entries (Boolean added to Printer Selections).
If the user doesn't already have a Report Selection for their ID/Report ID, and the Location has a default sales printer setup, Create a new record for that user/report combination. Commit it. Run the report as normal, after the report runs, delete the entry I created.
This way if something abnormal happened and the record wasn't deleted I catch it the next time they try to print by deleting all System Created entries for that user.
This scenario was a problem I was trying to solve when I saw this post and wrote the response and realized I could use it to get rid of having duplicate reports just to get the different default printers. Can be used for many scenarios...
Kevin
"Profanity is the one language all programmers know best."
I use it when printing a document to PDF.
1. Call the function "SelectPrinter". The printer name, the USERID and the report ID is given to the fucntion.
It looks upon the Report Selection table. If the user already has a printer associated with the report, it is saved in variables, and deleted.
A report selection line is created with the paramenters given.
2. Call the report
3. Call the function "RestorePrinter"
The line created by SelectPrinter is deleted. If the user had a printer before, it is restored.
Salut!
Author of the book Implementing Dynamics NAV 2013
Cursos Dynamics NAV (spanish) : http://clipdynamics.com/ - A new lesson released every day.
Is that doable using 1 printer?
Currently I have it working by creating a dummy report which loops thru the customers. For each customer I call the Customer Statement report to print. In the Customer statement report I added a call to the SalesInvoice report in the Report.OnPostReport trigger. That works but I thought there would be a more gentle way to get this to work.
Let me know.
PS: Laura, what do you have defined in your functions: SelectPrinterer and RestorePrinter?