Jump to content
JasperReports Library 7.0 is now available ×

xmldatasource and subdatasets


nicky15

Recommended Posts

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

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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.

Link to comment
Share on other sites

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...