Print multiple reports and have one preview

DosihrisDosihris Member Posts: 23
Hi,

when i pres the print-button i want that always two reports are printed. They are almost the same reports, but they are different in a few little things. what i need is when i press the preview-button i want that both are visible there. is that possible? what would be the best way to make that both reports are printed at once? is it possible to make an entry in table 77 (Report Selection)??

Nico

Comments

  • vikram7_dabasvikram7_dabas Member Posts: 611
    Dear Concern
    This is possible with coding.Just write the code in 1 report on its OnPostReport trigger and run the 2nd report and set userequestform to false of 2nd report in coding.
    I think it will solve ur problem.

    Cheers!!!!!!!!!!!
    Have a nice day
    Vikram Dabas
    Navision Technical Consultant
  • DosihrisDosihris Member Posts: 23
    Unfortunately i only found the "OnPostDataItem" in the report. And if i put this code in there, this report (report 2) is imediately printed if i press the PreView-Button of report 1.
  • DaveTDaveT Member Posts: 1,039
    Hi Nico,

    You will find the OnPostReport trigger if you select a blank dataitem and then select the C/AL code button (F9).
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • garakgarak Member Posts: 3,263
    select a BLANK DataItem (Blank Line) to have access to his Trigger
    Do you make it right, it works too!
  • garakgarak Member Posts: 3,263
    oh, Dave was faster
    Do you make it right, it works too!
  • DaveTDaveT Member Posts: 1,039
    garak wrote:
    oh, Dave was faster

    It's the first time :mrgreen:
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • garakgarak Member Posts: 3,263
    :wink:
    Do you make it right, it works too!
  • DosihrisDosihris Member Posts: 23
    Hi Dave, thanks, you're right. i found this trigger there. (Ah, hehe, and thanks garak too)

    i wrote the following line in that trigger of report one.

    REPORT.RUN(5078953,FALSE,FALSE,dataRecord);

    the numer is the id of the second report (the source question was how to see both reports in one preview). but actually if i do that nothing happens... (I wrote also a MESSAGE in this trigger but no message box appeared... so i think this trigger is not raised when i press the preview button).

    I have heard that this feature (to see more than one report in one preview) is not possible with NAV... :|
  • garakgarak Member Posts: 3,263
    edited 2009-01-04
    have heard that this feature (to see more than one report in one preview) is not possible with NAV...

    Thats true. It's like on printing. You can only view reports step by step.

    First Report A, then Report B and so on.

    Also the Report - OnPreReport() is fired, when the first when the user press the Preview / Print Button and before the first rec for the first dataitem is get.
    So your start function is Report - OnInitReport(). But also here (the new report is behind you report form), you must manuelly press the Preview Button. And this is not what you want. Àlso you can create a new Report that is based on both ;-)

    Question: Why do you need this?
    Do you make it right, it works too!
  • DaveTDaveT Member Posts: 1,039
    Hi Nico,

    I have not tested this solution but the onpostreport trigger should fire.

    If its only two reports then why not add the dataitem(s) and sections to the first report and make one "super" report.
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • DosihrisDosihris Member Posts: 23
    Well, if the user creates a new record in my form, he wants to print it always twice. one version for his customer and one version for his employees. these versions differ in a few little things. On this form he can select a category. and depending on this selected category the printer output differs. so if category 1 is selected, report 1a and report 1b is printed. if he selects category 2, report 2a and report 2b is printed. and i have almost 10 categories. and every report differs a little bit from every other report. at first i thought about making one of these "super"-Reports that contains everything and what is printed depends on a condition, but later i decided to copy every report and make these little changes (also the user wanted it that way)...

    So, and when the user selects category 1 report 1a and report 1b is printed and it would be very user-friendly, when he could handle both reports as one (while printing, with preview and so on)... Thats the idea...
  • garakgarak Member Posts: 3,263
    So, and when the user selects category 1 report 1a and report 1b is printed and it would be very user-friendly, when he could handle both reports as one (while printing, with preview and so on)... Thats the idea...

    So, in one Preview it's not possible. You can only run the Report 1b from 1a. But the user must then press the preview button self.
    For a direct print of report 1b from 1a u can use Report.run(ID,false,false,Rec) or, if you need before in report 1b some parameters. declare Report1b as variable and use
    Report1b.MyFunctionToSetSomeParameters(); 
    Report1b.USEREQUESTFORM(false);
    Report1b.run();
    

    Regards
    Do you make it right, it works too!
  • DosihrisDosihris Member Posts: 23
    Ah, thanks, so now its really clear i think. one preview is not possible. Right now i do both behind each other. But i see a little other problem. when i use what you wrote with Report.run(ID,false,false,Rec), the second report is printed immediately. ok, sounds good, but what happend when the user has selected a special printer for printing the first report? Where comes the other report out (that sentence sounds german...)? Here the default printer is taken, right?? so the second report should always be printed on the printer that was selected to print the first one.
  • garakgarak Member Posts: 3,263
    Report.run(ID,false,false,Rec);

    1st parameter is the ReportID
    2nd is UseRequestForm (to show the user the report so he can add some filters and can also change the defaultprinter)
    3rd is UseSystem Printer (true -> WindowsSystenPrinter, false -> Printer from PrinterSelection table)
    4th REc is the filtered Record
    Do you make it right, it works too!
  • DaveTDaveT Member Posts: 1,039
    Good Morning Guys,

    Thinking about what is required here - is it not similiar to the standard invoice print. In this report you have a copy loop based on the integer dataitem to print more that one copy and then conditional printing of sections. This will also solve the slight variances (I'm assuming) in the layout for the category type. You can pass the category down to the report (if not in the data) and then decide which sections to print.
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
Sign In or Register to comment.