ashitkamani
24th August 2010, 16:25
A new blog entry has been added:

How to convert Table Data to XML file

Hi Can anyone help me in how to convert baan Table data to a XML file?

ashishj
1st September 2010, 07:35
We can create/read a xml file with the help of predefined functions in BaaN.Please find a sample program for creation a xml file.i wish it will help you a lot.

function main.table()
{
long count
xml_mastersid = xmlNewNode("Masters_Data", XML_ELEMENT)

db.retry.point()

select ltfas008.*
from ltfas008
where ltfas008._index1 inrange {:year.f, :btno.f}
and {:year.t, :btno.t}
order by ltfas008._index1
selectdo

xml_itemid = xmlNewNode("FAM",XML_ELEMENT,xml_mastersid)
retVal = xmlNewDataElement("Asset_no", strip$(shiftl$(ltfas008.acod)), xml_itemid)
retVal = xmlNewDataElement("Asset_ext",ltfas008.aext,xml_itemid)
retVal = xmlNewDataElement("Description",strip$(shiftl$(ltfas008.ades)),xml_itemid)
retVal = xmlNewDataElement("Amount",amnt,xml_itemid)
retVal = xmlNewDataElement("Category",strip$(shiftl$(ltfas008.acat)),xml_itemid)
retVal = xmlNewDataElement("Sub-Category",strip$(shiftl$(ltfas008.scat)),xml_itemid)
retVal = xmlNewDataElement("Group", strip$(shiftl$(ltfas008.acat)), xml_itemid)
retVal = xmlNewDataElement("Service_Date",ltfas008.sdte, xml_itemid)
retVal = xmlNewDataElement("Purchase_Date",ltfas008.sdte, xml_itemid)
retVal = xmlNewDataElement("Current_qty",ltfas008.qty, xml_itemid)
retVal = xmlNewDataElement("Salvage_value", 1, xml_itemid)
retVal = xmlNewDataElement("Asset_Book", "COMP", xml_itemid)
retVal = xmlNewDataElement("Depreciation_code", strip$(shiftl$(ltfas008.dpcd)), xml_itemid)
retVal = xmlNewDataElement("Dim1", strip$(shiftl$(ltfas008.dim1)), xml_itemid)
retVal = xmlNewDataElement("Dim2", strip$(shiftl$(ltfas008.dim2)), xml_itemid)
retVal = xmlNewDataElement("Dim3", strip$(shiftl$(ltfas008.dim3)), xml_itemid)
retVal = xmlNewDataElement("Dim4", strip$(shiftl$(ltfas008.dim4)), xml_itemid)
retVal = xmlNewDataElement("Dim5", strip$(shiftl$(ltfas008.dim5)), xml_itemid)
retVal = xmlNewDataElement("Clife", ltfas008.clife, xml_itemid)
endif
endselect
file.name = "Master_Asset.xml"
file.path = "c:\" & file.name
serv.path = "/tmp/" & file.name
file.ptr = seq.open(serv.path,"w")
retVal = xmlWritePretty(file.ptr,xml_mastersid)
retVal = seq.close(file.ptr)
retval = server2client(serv.path,file.path,true,false)
file.ptr = 0
retVal = xmlDelete(xml_mastersid,0)
}

ashitkamani
15th September 2010, 18:24
thanks a lot