Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subreports and Parameters

Status
Not open for further replies.
Dec 2, 2003
58
US
Hi all,
I am using CR 10 with SQL server 2000. I have a report that contains two subreports in the report header. The main report has three parameters and one group. The parameters are
1. fromDate(date)
2. toDate(date)
3. levelinfoid(number)

The problem I am having is that the main report is using the parameters but the subreports are returing all the data in the database and not restricting them by parameters. I have linked the subreports on the field that the group is based on. Can someone please guide me in the right direction? I have tried suggestions from other posts but cant seem to figure it out.

My main report selection formula is:

(({cr_all_informal.lvl1id} = {?levelinfoid})
or
({cr_all_informal.lvl2id} = {?levelinfoid})
or
({cr_all_informal.lvl3id} = {?levelinfoid})
or
({cr_all_informal.lvl4id} = {?levelinfoid}))
and
{cr_all_informal.initial_contact} in {?fromDate} to {?toDate}

Any help would be appreciated.
Thanks!
 
Within the subreport create the same set of relevant parameters and filter the data accordingly.

When you add the subreports you can then link the parameters. On the subreport links tab, drag the parameter from the main report into the main linking window. In the bottom left hand side drop down list you will now see your subreport parameters. Highlight the corresponding parameter and they are now linked. Thus your parameter input is now passed down to to the subreport.

Ian
 
I'm using CR 8.0 and have a report with a formula @directrate, Sum ({LABTRANS.REGULARHRS})/Total Available Hours*100.

I want to create a datetime range parameter field and have the formula update the Total Available Hours value in the formula above based on the parameter's datetime range value chosen.

How can I easily accomplish this?

Thanks
Deana
 
Deana

You should really start a new thread with a new question, otherwise you may not get seen.

However, you just need to create 3 new parameters

@Reg_Hours
If {Datetime field} = {?DateTime Param} then
{LABTRANS.REGULARHRS}
else 0

@Total Hours
If {Datetime field} = {?DateTime Param} then
{Total Available Hours}
else 0

@Directrate2
If Sum({@Total Hours}) = 0 then 0
else
sum({@Reg_Hours})/ Sum({@Total Hours})*100

This bit
If Sum({@Total Hours}) = 0 then 0
of the formula prevents divide by zero errors.

Ian





YOu may also want to
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top