Jump to content
We've recently updated our Privacy Statement, available here ×

Xpath failure where XML consists of a list of lists


Recommended Posts

Hi,

I'm working with studio 6.1 and trying to generate a series of chart/table pairs. Each chart and table will use the same recordset.

My first step is to come up with an XML structure that serves both purposes. Essentially I have a list of records; each record contains a few  preamble nodes, followed by a list of data nodes. The snippet below captures what I'm currently working with.

<data>    <top_level>Blah</top_level>    <records>        <record>            <preamble>Blah</preamble>            <more_preamble>Blah</more_preamble>            <dateset>                <month>Jan</month>                <data attrib="A">10</data>                <data attrib="B">40</data>                <data attrib="C">20</data>                <data attrib="D">60</data>            </dataset>            <dateset>                <month>Feb</month>                <data attrib="A">30</data>                <data attrib="B">60</data>                <data attrib="C">80</data>                <data attrib="D">10</data>            </dataset>            <dateset>                <month>Mar</month>                <data attrib="A">70</data>                <data attrib="B">90</data>                <data attrib="C">100</data>                <data attrib="D">20</data>            </dataset>        </record>        <record>            <dateset>                <month>Aug</month>                <data attrib="A">90</data>                <data attrib="B">40</data>                <data attrib="C">70</data>                <data attrib="D">20</data>            </dataset>            <dateset>                <month>Sep</month>                <data attrib="A">60</data>                <data attrib="B">70</data>                <data attrib="C">10</data>                <data attrib="D">20</data>            </dataset>            <dateset>                <month>Oct</month>                <data attrib="A">20</data>                <data attrib="B">10</data>                <data attrib="C">0</data>                <data attrib="D">60</data>            </dataset>        </record>    </records></data>[/code]

To start with I've created a subreport and placed a chart in the detail band. Setting the record node to /data/records/record would enable me to create one chart per record. The fields are defined as follows:

preamble: preamblemore_preamble: more_preamblemonth: //dateset/monthtypeA: //dateset/data[@=A]typeB: //dateset/data[@=B]typeC: //dateset/data[@=C]typeD: //dateset/data[@=D][/code]

I'm using a stacked bar chart with Series A, B, C, and D; Category is set to $F{month} and value set to $F{typeA}, $F{typeB},$F{typeC},$F{typeD} respectively. I have also tried .//dataset... which make no difference.

What I get when I preview are 2 charts where each contains the first dateset from record 1 and the first dataset from record 2. Presumably, if I had a third record, it's first record would also be displayed.

I have a couple of questions:
1. Is there a better XML structure I should be using? What I have is easy to read but possibly isn't optimal when it come to charts and tables.
2. Can anyone explain what the heck is going on with my current setup? I can't understand why the xpath expressions fail.

Cheers

Chris

 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...