Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

powerbuilder how to display a pdf file after doing a SELECTBLOB from database?

245 views
Skip to first unread message

joj...@gmail.com

unread,
Apr 27, 2016, 2:39:24 PM4/27/16
to
PowerBuilder::: how to display a pdf file after doing a SELECTBLOB from database?

I was able to insert PDF file to DB, what is a simple way to show it on the screen after retrieving it from the DB ?


sample code:

//TFS1

blob blank_blob
blob blob_temp
blob lb_file
blob lb_our_blob
blob lb_tot_b
blob total_blob
boolean ib_wordopen
integer li_counter
integer li_filenum
integer li_rtn
integer result
long ll_ext
long ll_ret
long ll_row
long ll_rtn
OLEObject myoleobject
string ls_key
string ls_type

ll_row = dw_query.getrow()
ls_key = dw_query.GetItemString(ll_row, "inqnum" )
ll_ext = dw_query.GetItemNumber(ll_row, "ext_key")
ll_ret = ids_attachpricefile.retrieve(ls_key, ll_ext)

IF ll_ret > 0 THEN
ls_type = ids_attachpricefile.Getitemstring(1, "type")
ELSE
MessageBox("File Error", "There is no Notes attached file for this RFQ.")
RETURN
END IF

EXECUTE IMMEDIATE "SET TEXTSIZE 32765"
USING sqlca;

SELECTBLOB attpdf
INTO :total_blob
FROM mfg.RFQ_PRICING_FILE
WHERE record_key = :ls_key
AND ext_key = :ll_ext
USING sqlca;

ll_rtn = LenA(total_blob)

IF IsNull(ll_rtn) THEN
MessageBox("File Error", "There is no RFQ file attached file for this RFQ.")
RETURN
END IF

IF sqlca.sqlcode <> 0 THEN
MessageBox("connect error", "Unable to open the attached file.")
RETURN
END IF

integer li_test

CHOOSE CASE ls_type
CASE doctype_Pdf
myoleobject.ObjectData = total_blob
//// oleobject_1.ObjectData =total_blob
//// oleobject_1.event constructor( )
// ll_ret = dw_attpricefile.retrieve(ls_key, ll_ext)
// dw_attpricefile.Modify("total_blob.OleClass = 'AcroExch.Document'")
// // dw_attpricefile.Modify("tableblob.OleClass = 'AcroExch.Document'")
//
// li_test = dw_attpricefile.OLEActivate(1, "attpdf", 0)
CASE doctype_Doc, doctype_Txt
ll_ret = dw_attnote.retrieve(ls_key, ll_ext)
dw_attnote.Modify("total_blob.OleClass = 'Word.Document'")
dw_attnote.OLEActivate(1, "attword", 0)
CASE doctype_Xls
ll_ret = dw_attnote.retrieve(ls_key, ll_ext)
dw_attnote.Modify("total_blob.OleClass = 'Excel.Document'")
dw_attnote.OLEActivate(1, "attexcel", 0)
CASE doctype_Ppt
ll_ret = dw_attnote.retrieve(ls_key, ll_ext)
dw_attnote.Modify("total_blob.OleClass = 'PowerPoint.Document'")
dw_attnote.OLEActivate(1, "attppt", 0)
END CHOOSE

avd...@gmail.com

unread,
Nov 10, 2017, 10:28:11 AM11/10/17
to
El miércoles, 27 de abril de 2016, 20:39:24 (UTC+2), joj...@gmail.com escribió:
> PowerBuilder::: how to display a pdf file after doing a SELECTBLOB from database?
>
Hi, found you a method??. I need to open pdf from db but I don´t found a way without create the a file and open after.

Thanks,

Andrei Darie
0 new messages