1

谁能详细解释(如果可能,用屏幕截图)如何添加子报告(一对多关系)

这是 xml 数据源

<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>email1@my.domain.it</email>
      <email>email2@my.domain2.it</email> 

  </person>
  <person id="2">
      <LASTNAME>Fuller</LASTNAME>
      <FIRSTNAME>Andrew</FIRSTNAME>
      <email>email3@my.domain3.it</email> 
      <email>email4@my.domain4.it</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>email45@my.domain3.it</email> 
      <email>email455@my.domain4.it</email> 
  </person>
 </category>
 <category name="work">    
  <person id="4">                                                            
      <LASTNAME>Peacock</LASTNAME>
      <FIRSTNAME>Margaret</FIRSTNAME>
      <hobbies>
       <hobby>Toy Horse</hobby> 
      </hobbies>
      <email>Peacock@margaret.com</email>  
  </person>
  <person id="5">
      <LASTNAME>Buchanan</LASTNAME>
      <FIRSTNAME>Steven</FIRSTNAME>
      <hobbies>
      </hobbies>
      <email>Buchanan@steven.com</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>email25@my.domain3.it</email> 
  </person>
  <person id="9">
      <LASTNAME>Dodsworth</LASTNAME>
      <email>Dodsworth@my.anne.it</email> 
  </person>
 </category>                                                           
</addressbook>
4

1 回答 1

0

这里的这个页面正是你需要的:

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

基本上,有些人正试图完全按照您正在做的事情(使用相同的页面和所有内容)并且遇到了同样的问题。令人惊叹的是,他粘贴了他的 XML 数据源以及他的主报表和子报表 JRXML 文件。查看他的代码以了解他是如何做到的,然后使用第二条评论建议的 <datasourceExpression> 语法来让事情顺利进行。

于 2010-09-07T19:17:43.640 回答