0
votes

I have a datastore that contains the informations form a datawindow. I have two buttons - one for generating XML and one for opening the XML. Pressing the first one, I generate an XML file in a given path. But after generating the XML I want to be able to open it by pressing the second button. How can i make this in powerbuilder?!

This is my code for the first button:

string      ls_doc_name
long        ll_id_no

ll_id_no = idw_ids.object.id_no[1]

if wf_populate_ids(ll_id_no) < 0 then
    return -1
end if

ls_doc_name = 'SF_' + string(ll_id_no) + '_' + string(date(sysdate), "yyyymmdd")    

is_path_xml = 'c:\id_docs\' + ls_doc_name +  '.xml'   

ids_ids_data.Object.DataWindow.Export.XML.MetaDataType=XMLSchema!

ids_ids_data.saveas(is_path_xml, xml!, true)

Thanks!

2

2 Answers

0
votes

If you have .xml files associated with an application in Windows all you have to do is issue a 'Run ("myinput.xml")' command from the button click event. If you have some other application you want to use to open the xml you could dynamically create a .bat file which takes an input parameter and then run the bat file via a Run command: 'Run ("myfile.bat myinput.xml") and the bat file would start the other program sending the xml file as a parameter.

0
votes

This worked just fine for me:

integer li_rc
inet lcx_inet
li_rc = getcontextservice('Internet',lcx_inet)
If (li_rc <> 1) THEN
    messagebox('Clicked','getcontextservice failed')
ELSE
    lcx_inet.hyperlinktourl(is_path_xml)
END IF