Open File from Navision -> user can select the Applicatio

garak
Member Posts: 3,263
Hy,
when you have saved an file into an Blob (or you have saved the file on your HDD) and you will open it, you can use hyperlink. But hyperlink doesn't support all fileextensions and it will only open the regist. application or this fileextension (for exapmle Notepad for *.TXT) but when you need to open the file with an other Application, the user must have (will have) the chance to select the application he will use. For this case you can use "Standard functionality of windows". So i use the "Open with" Dialog. You must not reg. new DLLs!
Here an example: I've save the file into an Blob. Then i've save the Filename an the extension in semerate fields.
so, have fun with my codeexapmle.
Regards
when you have saved an file into an Blob (or you have saved the file on your HDD) and you will open it, you can use hyperlink. But hyperlink doesn't support all fileextensions and it will only open the regist. application or this fileextension (for exapmle Notepad for *.TXT) but when you need to open the file with an other Application, the user must have (will have) the chance to select the application he will use. For this case you can use "Standard functionality of windows". So i use the "Open with" Dialog. You must not reg. new DLLs!
Here an example: I've save the file into an Blob. Then i've save the Filename an the extension in semerate fields.
Variables: Name DataType Subtype Length FileDialog Codeunit Common Dialog Management Root Text 1024 MSCShell Automation 'Windows Script Host Object Model'.WshShell Rec.CALCFIELDS(Attachment); IF Rec.Attachment.HASVALUE THEN BEGIN Root := Rec."Attachment Description" + Rec."Attachment Extension"; CLEAR(FileDialog); Root := FileDialog.OpenFile('Dateipfad...',Root,4,Rec."Attachment Extension" + '|*' + Rec."Attachment Extension",1); IF (STRPOS(Root,':\') <> 0) THEN BEGIN Rec.Attachment.EXPORT(Root,FALSE); IF ISCLEAR(MSCShell) THEN CREATE(MSCShell); MSCShell.Run('rundll32.exe Shell32,OpenAs_RunDLL ' + Root); CLEAR(MSCShell); END; END;
so, have fun with my codeexapmle.
Regards

Do you make it right, it works too!
0
Comments
-
Use HYPERLINK, but not one line, you should export it firstly.
CALCFIELDS(fBlbExtFile); IF fBlbExtFile.HASVALUE THEN BEGIN lTxtFilePath := STRSUBSTNO('%1\%2',ENVIRON('TEMP'),fTxtFileName); lTxtFilePath := fBlbExtFile.EXPORT(lTxtFilePath,FALSE); IF lTxtFilePath <> '' THEN HYPERLINK(lTxtFilePath); END;
Michael
Navision Consultant0 -
I used HYPERLINK (and also tried Shell.RUN) even with a .PNG file and other files located on network folder with no problems on Microsoft Dynamics NAV 2009.Redcodestudio: Web Development, FLASH & Webdesign (and a little NAV, in the future)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