View content in BLOB format

Good Morning.
I have a doubt.
I developed a program that the user imports files (PDF, WORD, Excel, etc.) and saves the file in a BLOB table field in a bank table.
This logic is already working.
Now I need to put a button on the table where the user will "View" the file stored in this field.
Clicking the button should open the file
How do I implement this?
 

TomBascom

Curmudgeon
The simplest solution is to use COPY-LOB to write the BLOB to a file and then invoke the appropriate viewer command with that filename as the argument. Something along these lines:

Code:
find myData no-lock where myData.id = whatever.

copy-lob myData.myBLOB to file tmpFileName.

os-command myData.viewerCommand + " " + tmpFileName.

You could, of course, get fancy and invoke a DLL or GUI control of some such thing directly but that will depend entirely on your deployment environment, the specific tools that you have to work with and the gory details of the application. None of which you have shared so I am going with a "lowest common denominator" approach.
 

Cringer

ProgressTalk.com Moderator
Staff member
If you're on a Windows client then you can use the .Net framework to launch the file which can be a little more robust than os-command. Easier to trap errors.
Code:
System.Diagnostics.Process:Start (tmpFileName).

Edit: To clarify - that comes after the copy-lob statement.
 
Top