xmldatasource and subdatasets

Hello!

I am in desperate need for help!! I am trying to create a chart and am using an xmldatasource for the report. Heres my xml:
<sample>
<pieData>
<keyData>apple</keyData>
<valueData>20</valueData>
</pieData>
<pieData>
<keyData>orange</keyData>
<valueData>10</valueData>
</pieData>
<pieData>
<keyData>grapefruit</keyData>
<valueData>40</valueData>
</pieData>
</sample>
When I create a subdataset for the chart, I keep getting a Error:Null 'key' argument message. I have given the XPath for the subdataset as /sample/pieData I have created two fields in the subdataset with description 'keyData' and 'valueData' for the key and value expressions of the piechart respectively.

Why am I getting a null key error? Can anybody please tell me where I am going wrong? or what else I need to do? I have read the jasperreports ultimate guide but not finding any leads that would help me. Please!! Help!!

Thanks,
Nicky
nicky15's picture
15
Joined: Feb 8 2007 - 12:12pm
Last seen: 16 years 7 months ago

1 Answer:

I figured out the solution!
I am using JasperAssistant with JasperReports and in that it doesnt provide a way of specifying the datasource expression for the subdataset. This is what I had to do. I opened up the jrxml file and entered the expression manually. AND IT WORKED!!

The examples in the demo use database datasource. But if you are using XML you need to specify this in the subdataset otherwise it keeps giving you the null or nullpointer exception.

Thanks.
nicky15's picture
15
Joined: Feb 8 2007 - 12:12pm
Last seen: 16 years 7 months ago
Feedback