Creating data window Dynamically from XML

1
0
-1

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: 

Answers

Alexander Strelkov answered Creating data window Dynamically from XML

1
+2
-1

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.

shailapanwar@gmail.com'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.

shailapanwar@gmail.com's picture

I have this XML:

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

<table><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"><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="http://www.w3.org/2001/XMLSchema-instance"/></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" )
 )

shailapanwar@gmail.com'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.