Report calls report and output to PDF

RoelofRoelof Member Posts: 377
I created a report (A) that calls another report (B). A report has an option to print to PDF so that it shows on screen as a PDF format. But when I run report A with the PDF option, report B is not taking that in consideration and prints straight to the printer. Is there a way to transfer the PDF output option to Report B?
PS: I'm not thinking about the SAVEASPDF option.
Thanks.
Roelof de Jonghttp://www.wye.com

Answers

  • AluanAluan Member Posts: 164
    edited 2021-03-15
    Hello Roelof,
    how do you call the Report (B)?
    You could define a function, where the option for the PDF get's set and run the report afterwards.

    Example:
    Variable: 
    Name	        DataType	Subtype	Length
    ReportTest	Report	Report (B)
    
    Code:
    ReportTest.PrintAsPdf(True)
    ReportTest.RUN;
    

    PrintAsPdf is a function in Report(B) where you set the variable for the pdf print.
  • RoelofRoelof Member Posts: 377
    Hi Aluan,

    I understand your approach but I don't see an option in a report to set to print as PDF.
    Only 'SAVEASPDF'. Unless I miss something? Which variable for the pdf print would that be?
    Roelof de Jonghttp://www.wye.com
  • RoelofRoelof Member Posts: 377
    Is it the 'REPORTFORMAT' ?
    Roelof de Jonghttp://www.wye.com
  • vaprogvaprog Member Posts: 1,140
    REPORTFORMAT is to be used with REPORT.SAVEAS. But that is very similar to using SAVEASPDF. Why can't you use SAVEASPDF?
  • RoelofRoelof Member Posts: 377
    I don't want to have it saved as a file but straight to a screen.
    Roelof de Jonghttp://www.wye.com
  • vaprogvaprog Member Posts: 1,140
    So, you are referring to
    Roelof wrote: »
    A report has an option to print to PDF so that it shows on screen as a PDF

    25n9nx19acg0.png

    I don't know, how to access this information from within NAV.

    In the rdl layout you can find out using Globals!RenderFormat.Name, but I guess that does not help much here.
  • RoelofRoelof Member Posts: 377
    edited 2021-03-18
    Hi Vaprog,

    The reviewing using PDF option is working fine if you run just report B but what I have is calling report B from report A. If I use the PDF option in report A, it doesn't view but it prints straight to the printer. So I'm looking at functionality that I can set in report A for report B, before report B is printing.
    Roelof de Jonghttp://www.wye.com
  • AluanAluan Member Posts: 164
    edited 2021-03-18
    Ah okay,
    i thought you have already a function for the pdf print. Sorry for the late response.

    How do you call Report B from Report A right now?
    I think the easiest solution would either you show for the second Report the Requestpage, so that the user can select the PDF print, as shown from vaprog, or you use the SAVEASPDF function and afterwards the DOWNLOAD function.
    ToFile -> Text Variable.
    
    YourReport.SAVEASPDF('YourFileName');
    ToFile := 'ExampleFile.pdf';
    DOWNLOAD('YourfileName','','','',ToFile)
    
    

    If i use the above function, the file get's downloaded to my computer and get's directly openend in my pdf viewer.
  • vaprogvaprog Member Posts: 1,140
    Hi Reolof,
    Roelof wrote: »
    If I use the PDF option in report A, it doesn't view but it prints straight to the printer. So I'm looking at functionality that I can set in report A for report B, before report B is printing.
    Yes, I think I understood this. I assumed, you will want to print report B if the user chose to print report A, and show report B as PDF is the user chose to render report A as PDF. Therefor you need to be able to
    • Read the rendering target from report A
    • Set the rendering target in Report B
    Depending on exactly what you need to do, reading the rendering target from report A might not be needed. In any case you need to be able to set it. Anyway
    vaprog wrote: »
    I don't know, how to access this information from within NAV.
    This statement is true for both, reading and writing.

    So, I guess, your only options are those listed by @Aluan, unless someone else knows, how to set it. Possibly you can manipulate the RDL property I mentioned above, but I don't know.
  • RoelofRoelof Member Posts: 377
    Yeah, 'SAVEASPDF' is not an option I'm looking for.
    So, long story short: it's not possible what I had in mind. Bummer.
    Roelof de Jonghttp://www.wye.com
Sign In or Register to comment.