Jump to content
Changes to the Jaspersoft community edition download ×

problem whith XML Datasource and subreports


2006 IR Open Dicussion

Recommended Posts

By: Jeronimo Torres - major505

problem whith XML Datasource and subreports

2006-05-19 07:51

Hello,

 

I'm having a problem whith a subreport and xml datasource.

 

I have the folowing xml:

 

<?xml version="1.0"?>

<list>

<elem>

<d1>51</d1>

<d2>364</d2>

<d3>2</d3>

<d4>1,2,3</d4>

<d5>

<item1>1</item1>

<item2>$1.000,00</item2>

</d5>

 

<d5>

<item1>2</item1>

<item2>$5.000,00</item2>

</d5>

</elem>

</list>

 

 

I'm Trying to show the elements d1, d2, d3, d4 in my report (this part works fine!) and the elements of each d5 elements in a subreport.

Now is my doubt is how should i put the description in the object type field that i created to use as datasource of my sub report and how should be my fields in the sub report.

 

None of my attempts worked so far...

 

 

 

 

 

 

 

By: Wal Millard - walmillard

RE: problem whith XML Datasource and subrepor

2006-05-22 17:27

Jeronimo,

 

These XPath syntax can be a bit tricky at times but ur example here looks quite straight fwd.

 

put ur sub report in the group/band or main section of the master report. set its connection to us the datasource type and simply set the expression to point to the node you want to loop thru in the subreport...

 

"/list/elem/d5"

 

like this :

 

((net.sf.jasperreports.engine.data.JRXmlDataSource) $P{REPORT_DATA_SOURCE}).dataSource("/list/elem/d5")

 

add fields

 

item1 description item1

item2 description item2

 

add field objects on the main section or group/band of ur subreport and set them to these fields.

 

 

luck

WalMillard

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