I need to print 2 copies of a report. The printing is initiated from a form. It is the Delivery Ticket and the user does not want to use carbon copy (multiple copy) sheets. They want the system to just print 2 copies on white paper. I did the following: REPORT.RUNMODAL(REPORT::“Printed Delivery Ticket”,FALSE,FALSE,DelTicketHeader); REPORT.RUNMODAL(REPORT::“Printed Delivery Ticket”,FALSE,FALSE,DelTicketHeader); It works from one of the forms - Form to select a ticket for re-printing. Here the OnPush trigger of the Print button has the following code: CurrForm.SETSELECTIONFILTER(Rec); REPORT.RUN(REPORT::“Printed Delivery Ticket”,FALSE,FALSE,Rec); REPORT.RUN(REPORT::“Printed Delivery Ticket”,FALSE,FALSE,Rec); RESET; But when I do the same thing from another form(Load Tansaction) it does not work. During the post, the delivery ticket Header and Line table records are created and then the delivery ticket is printed. Here, it prints only once though I have the REPORT.RUN command twice. Pari Somasundaram.
I hate to ask the obvious question, but I will. Have you tried REPORT.RUNMODAL in the instance where REPORT.RUN doesn’t work to give you the second copy? Dave Studebaker das@libertyforever.com Liberty Grove Software A Navision Services Partner
quote:
Originally posted by daves: I hate to ask the obvious question, but I will. Have you tried REPORT.RUNMODAL in the instance where REPORT.RUN doesn’t work to give you the second copy? Dave Studebaker das@libertyforever.com Liberty Grove Software A Navision Services Partner
I apologise for not being clear. Yes, the form from which it does not print twice uses the command REPORT.RUNMODAL. I had to use RUNMODAL instead of RUN because RUN created some problems. Pari Somasundaram.
On the surface at least, it doesn’t seem that the printing should work once then fail unless something was changed by the action of the first report run. Hence the following question. Is there any possibility of a filter being set within the first instance of the report that would cause the second instance of the report to not have access to data needed to do its processing / printing? Dave Studebaker das@libertyforever.com Liberty Grove Software A Navision Services Partner
Have a look at the report no 206 INVOICE
quote:
Originally posted by daves: On the surface at least, it doesn’t seem that the printing should work once then fail unless something was changed by the action of the first report run. Hence the following question. Is there any possibility of a filter being set within the first instance of the report that would cause the second instance of the report to not have access to data needed to do its processing / printing? Dave Studebaker das@libertyforever.com Liberty Grove Software A Navision Services Partner
Thanks David. You were right. I should have thought about that. The first time the report prints it sets the printed flag to TRUE in the table. The filter for printing was that flag should be FALSE. Thanks again. Pari Somasundaram.
quote:
Originally posted by FGabriels: Have a look at the report no 206 INVOICE
I agree with Fabrice. There are much more elegant ways of printing several copies of a report than simple running a report twice. As Fabrice said, check out the Invoice report to see how. Kind regards, Jan Hoek Weha Automatisering BV Woerden - The Netherlands
I’m looking at the US version and don’t have a report # 206. In looking at the Invoice reports that I do have, I see the multiple copies function handled by clever use of the Integer virtual table. While this might be considered more elegant (at least more general purpose), the fact that this construct is only documented by example (I’ve not found any tutorial documentation on using the Integer table to drive various functions, even though it’s widely used in Navision’s code), makes this NOT a simple solution. Pari’s approach IS simple. And I’ve always believed there is good argument for equating simple to elegant. Dave Studebaker das@libertyforever.com Liberty Grove Software A Navision Services Partner
David, the trade-off comes when upgrading to the next version. When multiple-copies are taken care of in the report(s) itself, upgrading will be far more easy than scanning the forms for possible modifications. Furthermore, our rules are a) not to program behind forms and b) to parameterize something a user can select. If our programmers would be hard coding something like this, they would get their knuckles rapped. Suppose the customer asks for three copies of the report next month… And yes, using the integer table for widely varying tasks in reports or dataports is not (clearly) documented. But this should not be an excuse, there are many other undocumented “tricks” in Navision. Discovering these and applying 'm for your own use is part of your learning curve to master the package. John
John, I totally agree with your points about the “Navision standard” approach being better design. Pari’s technique, which I was endorsing as a reasonable shortcut, is likely to prove to be a stumbling block somewhere down the line. I would like to get on my soapbox for a minute though. I don’t think there is any excuse for Navision not providing a programming practices guide document. By not doing so, they cause the expenditure of many thousands of valuable developer hours in unnecessary learning curve time. I’m sure, given the consistency and high quality (generally) of code that Navision developers deliver, that Navision has such documentation for internal use. That documentation should be shared with the certified Navision developers in the field. We are in essence, an extension of Navision’s house staff, in many ways as critical to Navision’s success as the internal developers. We should have access to ALL the useful development and design guiding documentation they can provide. To do otherwise, as they have done, is to waste a great deal of valuable resources that could otherwise be helping to generate for them (and us) more revenue. OK, I’m down off my soapbox. But if anyone has any ideas how we might get Navision to act differently in this instance, please speak up. I’m going to start by posting this in a new thread. Dave Studebaker das@libertyforever.com Liberty Grove Software A Navision Services Partner
One of the most important reasons in this could be also user simplicity: It’s easier for the user to simply fill a textbox in the request form asking the number of copies he will print than filling again the filters for the reports… specially if working with reports that are defined on setup, like the sales & purchases ones… if you hard-code which report to use, when changing the set-up you’ll have to re-hardcode it or use other tricks… Alfonso Pertierra (Spain)apertierra@teleline.es Edited by - apertierra on 2001 Dec 19 00:38:51
quote:
Originally posted by daves: I’m looking at the US version and don’t have a report # 206. In looking at the Invoice reports that I do have, I see the multiple copies function handled by clever use of the Integer virtual table. While this might be considered more elegant (at least more general purpose), the fact that this construct is only documented by example (I’ve not found any tutorial documentation on using the Integer table to drive various functions, even though it’s widely used in Navision’s code), makes this NOT a simple solution. Pari’s approach IS simple. And I’ve always believed there is good argument for equating simple to elegant. Dave Studebaker das@libertyforever.com Liberty Grove Software A Navision Services Partner
David: In US version can you please tell me what report # you looked at to see how the multiple copies is handled? Thanks Pari Somasundaram
Pari, Glad to. See any of 10073 through 10076, 10120 through 10124, in each case the Copyloop. Happy studying. Dave Studebaker das@libertyforever.com Liberty Grove Software A Navision Services Partner
If you look at any of the posted invoices or CRMs and see how the copyloop section works. Paul Baxter
quote:
Originally posted by Pari: In US version can you please tell me what report # you looked at to see how the multiple copies is handled?
Basically the method used is: 1) Create an integer var where to store the number of copies the user wants and getting the value in the request form of the report (if you are having always 2 copies you can set by default that value to 2 on start). 2) If the value the user enter is 0 → Print just the first copy. 3) Create an integer section over the existant ones on the report that will control the number of times you’ll print the report. 4) For not affecting to the output when looking the report, remove the sections from the new integer dataitem. Example: if the report is something like -sales header --sales lines it will become like this: -integer --sales header —sales lines Regards, Alfonso Pertierra (Spain)apertierra@teleline.es
quote:
Originally posted by apertierra:
quote:
Originally posted by Pari: In US version can you please tell me what report # you looked at to see how the multiple copies is handled?
Basically the method used is: 1) Create an integer var where to store the number of copies the user wants and getting the value in the request form of the report (if you are having always 2 copies you can set by default that value to 2 on start). 2) If the value the user enter is 0 → Print just the first copy. 3) Create an integer section over the existant ones on the report that will control the number of times you’ll print the report. 4) For not affecting to the output when looking the report, remove the sections from the new integer dataitem. Example: if the report is something like -sales header --sales lines it will become like this: -integer --sales header —sales lines Regards, Alfonso Pertierra (Spain)apertierra@teleline.es
Thanks to all for your suggestions. I think I have it working now without hardcoding to call the report twice to print twice. I love this Forum. Great advice/solutions from co-Navision Developers. The response time is very good too. Once again, thankyou all. Pari Somasundaram.