Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xml structure and crystal reports

Status
Not open for further replies.

natashaXXX

Programmer
Sep 13, 2002
13
GB
I want to report off an xml file with structure

<details>
<data>
<name>fred</name>
<balances>
<shares>45</shares>
<share_type>
<ordinary>A-type</ordinary>
</share_type>
</balances>
</data>
<data>
<name>mark</name>
<balances>
<shares>66</shares>
<share_type>
<ordinary>B-type</ordinary>
</share_type>
</balances>
</data>
</details>

How can I have a report showing

name shares share_type.

There are no linking fields between the tables, but surely the xml structure dictates that the Mark owns 66 shares, of B-type. Can Crystal read this structure? I have tried with no success, unless I create additional tags in each table to link the tables. Please advise if I can avoid this.
 
No can do, Crystal has an extremely non-xml xml driver.

Solution: Create several flat tables (xml files with only one table in them), like

<table>
<row>
<name>Fred</name>
<shares>...
<shares_type>...
</row>
</table>

Everything you use has to be on the same level.
Then you set either the table hint to /table or row hint to //row
If the columns in the table (name, shares,...) are elements (like above), you may have to add add \column child, if they are in attributes add \column attr to the row hints, if you use them. But try and use only elements, works surely.


You can have several tables in one xml file, but it goes easier with having several xml files, one for each table. If necessary, split them with xsl transforms.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top