I need to create an XML file with a set of tables. The requirement is that one of the tables is surrounded by an extra tag that indicates the plural form of the element below. As an example: for the orders of a customer the XML should look something like this:
<Customer>
<Num>1234</Id>
<Name>Lift Line Skiing</Name>
<Orders>
<Order>
<Id>6</Id>
<Date>08/02/1993</Date>
<Amount>1.829,50</Amount>
</Order>
</Orders>
...
I can achieve this with an extra temp-table in my dataset like this:
DEFINE TEMP-TABLE ttCustomer LIKE customer. DEFINE TEMP-TABLE ttOrders FIELD custnum AS INTEGER. DEFINE TEMP-TABLE ttOrder LIKE order. DEFINE DATASET dsCustOrders FOR ttCustomer, ttOrders, ttOrder DATA-RELATION drCustOrder FOR ttCustomer, ttOrders RELATION-FIELDS(custnum,custnum) DATA-RELATION drOrders FOR ttOrders, ttOrder RELATION-FIELDS(custnum,custnum).
But the table ttOrders is actually only needed to get the <Orders> tag in the XML file. Is there a better way?
Elsworth Burmeister |
Developer - Managed Services |
Cell: +27 83 777 3072 Email: eburmeister@elcb.co.za |
|
ELCB Information Services (Pty) Ltd |
Customer Service Email elcb@elcb.co.za · www.elcb.co.za |
E A S T L O N D O N Tel: +27(43) 704 0700 Fax: +27(43) 704 0701 |
J O H A N N E S B U R G Tel: +27(10) 035 0310 Fax: +27(10) 035 0311 |
P O R T E L I Z A B E T H Tel: +27(41) 373 0529 Fax: +27(86) 650 0135 |
Thanks for the tip, I did not know one could do this like this. Nice.
It gives me the same structure for my Dataset back as what I came up with myself, so that means I really need those linking temp-tables. Thats sad because I only need them for the XML and not for the program itself.
Yes its a great way of doing things and it makes life easy,faster and more efficient... you will run into times where you get errors generating the .i from the xsd but thats because of the structure of the xml... :)
Wow, I wish I had known about this earlier. We did quite some experimenting to get temp-table definitions right just to solve exactly the same issue as Patrick had.
This is nice!
no problem... a guru once shared this with knowledge with me so i thought id return the favor... It works well when doing integration projects (rest services) when receiving xml from a client...as progress works prominently with datasets, makes startup on these projects much faster....