Open File from BLOB data

Jatin_Patel
Member Posts: 200
Hello,
I have one table like this:
Name Datatype Size
No. code 20
name text 250
Filelocation text 250
attachment blob
i want to copy all file stored in this table at any temporary location in folder.
and also want be opened all files in appropriate application like (txt in notepad,doc in word etc.)
when i close all temporary file i wanted to be deleted all file from temporary location but remain in table.
how can i do this?
Please tell me some code or Suggestion...
Thanks....
I have one table like this:
Name Datatype Size
No. code 20
name text 250
Filelocation text 250
attachment blob
i want to copy all file stored in this table at any temporary location in folder.
and also want be opened all files in appropriate application like (txt in notepad,doc in word etc.)
when i close all temporary file i wanted to be deleted all file from temporary location but remain in table.
how can i do this?
Please tell me some code or Suggestion...
Thanks....
Jatin Patel
Microsoft Dynamics NAV Consultant
Jatin's Blog
Microsoft Dynamics NAV Consultant
Jatin's Blog
0
Answers
-
as far as i know you can stream the files to a temporary location and then open them by using the hyperlink function.
however it depends on your client version if this function can be used or not.0 -
I suggest you have a look at the table 5062 Attachment.0
-
I guess it's your lucky day:
IF recMyTable.FINDSET THEN REPEAT recMyTable.CALCFIELDS(attachment); IF recMyTable.attachment.HASVALUE THEN BEGIN recMyTable.attachment.EXPORT('c:\Temp\' + recMyTable.name,FALSE); HYPERLINK('c:\Temp\' + recMyTable.name); END; UNTIL recMyTable.NEXT = 0; WHILE intWait < 10 DO BEGIN SLEEP(1000); intWait := intWait + 1; END; IF recMyTable.FINDSET THEN REPEAT recMyTable.CALCFIELDS(attachment); IF recMyTable.attachment.HASVALUE THEN FILE.ERASE('c:\Temp\' + recMyTable.name); UNTIL recMyTable.NEXT = 0;
You won't be able to detect when the application is closed, as HYPERLINK runs the application without feedback to NAV. That's why I used a loop to pause NAV execution, before removing the files. If the files are removed before the applications are able to load the files, you will have to increase this pause loop.No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)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