java - JasperReports: subreport pagination -


i've been searching weeks problem on internet, haven't found yet, here problem, wish here can me solve this.

imagine have following data:

customer -------- cid : 1 | name: john  ; cid : 2 | name: smith ;  phonenumber ----- cid : 1 | number: 1234 ; cid : 1 | number: 5678 ; cid : 1 | number: 4321 ; cid : 2 | number: 6745 ; cid : 2 | number: 3124 ; 

i want make report subreport inside following requirements:

  • customer id -> 'cid' use report parameter
  • report show 1 customer his/her phone number
  • one page must show 1 customer 1 phone number

for example took customer details above 'cid' = 1, generate 3 page because customer name "john" have 3 phonenumber.

page 1:

customer name: john - phone number: 1234

page 2:

customer name: john - phone number: 5678

page 3:

customer name: john - phone number: 4321

my questions are:

  1. how setup main report generate page according how many subreport details?
  2. which property need set on main report or subreport fulfill requirement?

1
main report query should return phone numbers want show. like:

select phone_number ... cid=$p{cid} 

then add subreport in detail band, , give field value ($f{phone_number}) parameter. in subreport, can select more information second value.

2
pagination more tricky , not easy jasper, there workaround.
in project make sure bands hight want them. in case - create main report - headers etc. , calculate hight need detail band take whole page. make sure subreport in in size.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -