Creating data window Dynamically from XML


Can we create Data window dynamically from XML in PB17.

The XML can vary hence each time it could have deferent number of elements.

Please share any example if it can be done.




Question Tags: 


Alexander Strelkov answered Creating data window Dynamically from XML


In our project we create all DataWindow objects dynamically. DW syntax is generated on the basis of data that stored in the meta database or in XML. You can see some example here.'s picture

We are getting the xml from the webservices and not storing anywhere in the database.

Moreover these XML's can contain varying element depending upon the logic there is no XML which will be similar.


frontier-erp_16622's picture

Basically where you store description of the visual object (dw) doesn't matter. It can be done in the database or gets from some external source or via webservices. The whole structure of XML may be different and varies from the usage context. But some required XML elements are needed however.'s picture

I have this XML:

<?xml version="1.0" encoding="UTF-16LE" standalone="no"?>

<table><xs:schema xmlns:xs=""><xs:element name="myxml"><xs:complexType><xs:sequence><xs:element ref="myxml_row" maxOccurs="unbounded" minOccurs="0"/></xs:sequence></xs:complexType></xs:element><xs:element name="myxml_row"><xs:complexType><xs:sequence><xs:element ref="package"/></xs:sequence></xs:complexType></xs:element><xs:element name="package" type="xs:string" nillable="true"/></xs:schema><myxml xmlns:xsi=""/></table>

Currently it has one element which is package but there could be more element in this XML.

What I am looking for here is that I cannot use SytaxFromSQL here because it will be an external datawindow.

In that case how I will create the Syntax and use Create function for the datawindow.

frontier-erp_16622's picture

SyntaxFromSQL is very slow and not productive for such task/s. You must generate dw syntax on your own. Extract syntax from some example datawindow, analyze it and write similarly. This process is time consumed, but result is worth it.

Roland's picture

Here is bare minimum External DW syntax:

release 12.5;
datawindow(color=1073741824 processing=1 )
header(height=80 color="536870912" )
summary(height=0 color="536870912" )
footer(height=0 color="536870912" )
detail(height=92 color="536870912" )
table(column=(type=char(10) name=column1 dbname="column1" )
 column=(type=char(10) name=column2 dbname="column2" )
 )'s picture

Thanks for the Syntax that can be taken from the Edit Source.

What I am looking for is how I would run through the XML to get the elements which can be added as columns in the datawindow dynamicaly.