Jump to content
JasperReports Library 7.0 is now available ×

Pass param from master to subreport-wnt work


2006 IR Open Dicussion

Recommended Posts

By: pea - misterpea

Pass param from master to subreport-wnt work

2006-02-19 17:45

Hi All!

 

I've trawled through the net and this forum the last 2 days to no avail :(

 

What I want: A master report that prompts for parameters, which gets passed into a subreport.

 

What I have: A master report with a title and a subreport element. The subreport points to another report (of course) which contains an sql like:

 

select count(*) as total_count from tblName where theDate >= to_date($P{fromDate}, 'dd-mm-yyyy') and theDate <= to_date($P{toDate}, 'dd-mm-yyyy');

 

in my subreport i have added the report parameters, and the subreport runs fine on its own.

 

in my master report, i have also added the report parameters.

going to the subreport's properties dialog, in Subreport (Other) I have the subreport's filename "c:\reports\subreport.jasper" and Subreport parameters I have:

 

Parameter Expression

fromDate $P{fromDate}

toDate $P{toDate}

 

However when i run the master report, and enter in the fromDate and toDate values (prompts), it says 'The document has no pages'.

 

This cannot be right as I know I have data, since the subreport run on its own retrieves the count fine :(

 

Anyone know what I'm doing wrong?

I need this done ASAP :(

 

Thanks for any help!

Nic

 

 

 

 

By: Giulio Toffoli - gt78

RE: Pass param from master to subreport-wnt work

2006-02-20 10:13

Perhaps the master has no pages.

 

Go to View -> report properties -> tab more... and set when no data to "AllSectionsNoDetail"

 

Now put your subreport in a "Non detail band" like the title or the summary.

 

You have anyway to use a sql query to fill the parent. Try something like:

 

select 1 from dual (this works on Oracle) or

select now() field1; (this works on MySQL 5)

 

Giulio

 

Giulio

 

 

 

 

By: pea - misterpea

RE: Pass param from master to subreport-wnt work

2006-02-20 13:27

Hi Giulio,

 

Once again thanks for helping!

I'm no longer getting the 'no pages' message, however do u know why my subreport showing anything?

 

it's just blank :( my static texts in the master report shows up etc, but nothing in my subreport.

 

if i run the subreport without the master report, i get a result (ie. TOTAL_COUNT: 100).

 

cheers!

nicole

 

 

 

 

By: pea - misterpea

RE: Pass param from master to subreport-wnt work

2006-02-21 21:01

I finally got it to work!

anyone having the same prob, here was my solution:

 

http://sourceforge.net/forum/message.php?msg_id=3238213

 

phew!

 

thanks for all your help :)

 

nicole

http://www.terrapages.com

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