Options

Source Tables for report in SAVEASPDF

rnjbngrnjbng Member Posts: 82
Hi Folks -

I have been asked to create a report that will run through the Report Inbox table save the report as PDF and attach the report to email and send it to the user id in report inbox table. The help I need is to save the report as PDF, I am using

REPORT.SAVEASPDF(REPORTID,FILENAME,REC);

Unfortunately I am not sure how to get the REC from the report inbox table. I have the report ID in the Report Inbox table but to save it as PDF how do I get the REC part. If I am on a Posted Sales invoice I know the record I am on but from Report ID I just don't know how to get the REC part.

Also, in the Report Output field in the Report Inbox table the report is saved in a BLOB field but when I tried to extract the information from BLOB field and create a file it does not like the file when attached causing errors.

Any help is highly..highly..appreciated.

Thanks

RJ.

Best Answer

Answers

  • Options
    Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    edited 2017-08-21
    Hi,

    You will not be able to find a source record just using the data from the Report Inbox, but you don't need to do so.

    The Report Inbox table is a destination, not a source for a report.

    The job queue processing code is using the Report Inbox. The job knows the report ID and the record - if the report is supposed to run with some record, and if the report was supposed to print something the actual report output is stored in the Report Inbox table, in the Report Output field.

    If you need to print it out you can stream the Report Output to a file, as you've tried. Just remember that the file generated would be a PDF, a Word or an Excel file - check the Output Type column for details. Then you can print generated file opening it in related application and printing it from there.

    Slawek
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • Options
    rnjbngrnjbng Member Posts: 82
    Hi Slawek -
    Thanks for your response. I don't want to print the report, I want to save the contents of the field Report output in Report Inbox table to a file and I tried DOWNLOADSTREAM function but it prompts to either Open, Save the file. Unless user intervention is there it won't do anything. Is there any way I can just save the contents of the Report output field value to a file. Thanks for your help.

    Regards
    RJ
  • Options
    rnjbngrnjbng Member Posts: 82
    Many..Many..Many Thanks Slawek, that worked. Thanks for helping me out.

    Regards
    RJ.
Sign In or Register to comment.