tags:

views:

132

answers:

1

can anyone explain in detail(if possible with screen shorts) how to add subreport (one to many relation)

this being the xml data source

<addressbook>
 <category name="home">
  <person id="1">                                                           
      <LASTNAME>Davolio</LASTNAME>
      <FIRSTNAME>Nancy</FIRSTNAME>
      <hobbies>
       <hobby>Radio Control</hobby>
       <hobby>R/C Cars</hobby>
       <hobby>Micro R/C Cars</hobby>
       <hobby>Die-Cast Models</hobby>
      </hobbies>
      <email>[email protected]</email>
      <email>[email protected]</email> 

  </person>
  <person id="2">
      <LASTNAME>Fuller</LASTNAME>
      <FIRSTNAME>Andrew</FIRSTNAME>
      <email>[email protected]</email> 
      <email>[email protected]</email> 
  </person>
  <person id="3">                                                                 
      <LASTNAME>Leverling</LASTNAME>
      <FIRSTNAME>Janet</FIRSTNAME>
      <hobbies>
       <hobby>Rockets</hobby>
       <hobby>Puzzles</hobby>
       <hobby>Science Hobby</hobby>
       <hobby>Toy Horse</hobby> 
      </hobbies>
      <email>[email protected]</email> 
      <email>[email protected]</email> 
  </person>
 </category>
 <category name="work">    
  <person id="4">                                                            
      <LASTNAME>Peacock</LASTNAME>
      <FIRSTNAME>Margaret</FIRSTNAME>
      <hobbies>
       <hobby>Toy Horse</hobby> 
      </hobbies>
      <email>[email protected]</email>  
  </person>
  <person id="5">
      <LASTNAME>Buchanan</LASTNAME>
      <FIRSTNAME>Steven</FIRSTNAME>
      <hobbies>
      </hobbies>
      <email>[email protected]</email>  
  </person>
  <person id="6">
      <LASTNAME>Suyama</LASTNAME>
      <FIRSTNAME>Michael</FIRSTNAME>
  </person>
  <person id="7">
      <LASTNAME>King</LASTNAME>
      <FIRSTNAME>Robert</FIRSTNAME>
  </person>
 </category>
 <category name="Other">    
  <person id="8">   
      <LASTNAME>Callahan</LASTNAME>
      <FIRSTNAME>Laura</FIRSTNAME>
      <email>[email protected]</email> 
  </person>
  <person id="9">
      <LASTNAME>Dodsworth</LASTNAME>
      <email>[email protected]</email> 
  </person>
 </category>                                                           
</addressbook>
A: 

This page here has exactly what you need:

http://jasperforge.org/plugins/espforum/view.php?group_id=83&amp;forumid=101&amp;topicid=48534

Basically some guy was trying to do exactly what you're doing (with the same page and everything) and had the same problem. Awesomely enough, he pasted in his XML datasource and his master and subreport JRXML files. View his code to see how he did it, then use the <datasourceExpression> syntax the second comment suggests to get things going.

Gabriel