Store a report image in a BLOB field

rsaritzky
Member Posts: 469
Hi all,
When we ship orders, we generate some paperwork for export and some other documents. These documents are generated through standard NAV reports.
I'd like to store these reports in some BLOB fields for archival purposes (rather than regenerating the reports at a later time).
I've read a number of posts on storing files in BLOBS, but I'm looking for any shortcuts, considering most of them include the step of transferring the files to the server and converting to Base64 first. Since I am thinking about generating the report as a PDF using the REPORT.SAVEASPDF command, the file will already be on the server, i.e.
REPORT.SAVEASPDF(ReportIDToRun,ServerAttachmentFilePath,CustRec);
So "ServerAttachmentFilePath" is the full path and filename of my temp PDF file. What are the statements needed to load this file it into a BLOB field in one of my tables?
Thanks
Ron
When we ship orders, we generate some paperwork for export and some other documents. These documents are generated through standard NAV reports.
I'd like to store these reports in some BLOB fields for archival purposes (rather than regenerating the reports at a later time).
I've read a number of posts on storing files in BLOBS, but I'm looking for any shortcuts, considering most of them include the step of transferring the files to the server and converting to Base64 first. Since I am thinking about generating the report as a PDF using the REPORT.SAVEASPDF command, the file will already be on the server, i.e.
REPORT.SAVEASPDF(ReportIDToRun,ServerAttachmentFilePath,CustRec);
So "ServerAttachmentFilePath" is the full path and filename of my temp PDF file. What are the statements needed to load this file it into a BLOB field in one of my tables?
Thanks
Ron
Ron
0
Best Answer
-
Try something like...
CLEAR(TempBlob); ThreeTierMgt.BLOBImport(TempBlob,ServerAttachmentFilePath,FALSE); MyTable.ReportBLOBField := TempBlob.Blob; MyTable.MODIFY;
5
Answers
-
Could you schedule a report, and this gets stored on Report Inbox table (477). This can be viewed from the role center page. This report attachment stores as blob field, and has the code to read as well.
Ashok
ArcherPoint Inc.,1 -
Try something like...
CLEAR(TempBlob); ThreeTierMgt.BLOBImport(TempBlob,ServerAttachmentFilePath,FALSE); MyTable.ReportBLOBField := TempBlob.Blob; MyTable.MODIFY;
5 -
Hi Kishorm - this is for NAV2016, so the ThreeTierMgt codeunit (CU419) does not exist. However, with this as a hint, I found a similar function in the new version of CU419 "File Management" - there is a corresponding function "BlobImport", which I will test. Thanks for the hint!
RonRon0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions