Writing a BLOB to a file

bhalpin
Member Posts: 309
Hi.
I've tried, but can't find documentation to explain this simply (well, simple enough for me) or an example.
All I want to do is write the contents of a BLOB (a picture) to a file - without the "Save As" dialog (I have a filename/path already.)
This is as far as I get:
And this is the error:
You are using an invalid datatype for this function
Can someone show me where I'm missing something?
Thanks!!!
(PS - This is NAV 4.0 SP3.)
I've tried, but can't find documentation to explain this simply (well, simple enough for me) or an example.
All I want to do is write the contents of a BLOB (a picture) to a file - without the "Save As" dialog (I have a filename/path already.)
This is as far as I get:
// PicFile - File // OStream - Outstream // Filename - text(30) FileName := 'C:\SOMEFILENAME.BMP'; IF EXISTS(FileName) THEN ERASE(FileName); PicFile.CREATE(FileName); PicFile.TEXTMODE(FALSE); PicFile.CREATEOUTSTREAM(OStream); OStream.WRITE(Rec.Blob); PicFile.CLOSE;
And this is the error:
You are using an invalid datatype for this function
Can someone show me where I'm missing something?
Thanks!!!
(PS - This is NAV 4.0 SP3.)
0
Answers
-
Have a look at the helpfile, for the EXPORT() function of the BLOB datatype.
EXPORT (BLOB) Use this function to export a BLOB (Binary Large Object).
0 -
Ah, right, got it: BLOB.EXPORT(<filename>,FALSE);
Thanks.0 -
This function has become obsolete in the RTC :-(
Is there a way to export the content of a blob (xml in my case) to a file from the RTC?
Regards,
Jes0 -
in Codeunit 419 - 3-Tier Automation Mgt., we have two functions for importing and exporting BLOB files..BLOBImport and BLOBExport for RTC
Have a look at them.. :thumbsup:0 -
very cool! Thanx, Mohana!0
-
I am importing all files (*.*) in Blob Import Function but while exporting i need to give the extension. Please let me know how to give extension of the file while is present in the Blob field0
-
As the filename (and extension) is not stored in the BLOB-field, you need to store it in a separate field in your table when importing the BLOB.No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0
-
Can you please explain me in detail how to store it in a sepearate field in Table
This is my code in Import :
FileExists := Rec.Attachment.HASVALUE;
IF Rec.Attachment.IMPORT('*.*',TRUE) = '' THEN
EXIT
ELSE
IF STRPOS(Rec.Attachment.IMPORT('*.*',TRUE),'.') = 0 THEN
ExtensionFile := COPYSTR(Rec.Attachment.IMPORT('*.*',TRUE),1);
MODIFY;
IF FileExists THEN
IF NOT CONFIRM(Text004,FALSE) THEN
EXIT;
CurrForm.SAVERECORD;0 -
Can anybody tell me how to store filename and its extension which is imported through Blob Import Function (*.*)?0
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