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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameters & Subreports

Status
Not open for further replies.

LLowrance

Programmer
May 11, 2004
47
US
I have a couple of questions. I'm using CR 8.5.
I have a main report which is prompting the user for several pieces of information.

1. Business Unit - there are 7 choices (6 offices, 1 All)
This is the selection criteria formula I have:

({?BusinessUnit}="All"or {?BusinessUnit}=totext({tbl_dw_Case_info.Business_UNIT}))

Is there a better way to get the "All" to select all business units? The data is returned for the main report but when I try to use this as a link to the subreport and pass it to the selection criteria, my subreport is blank. It worked previously before I put the option for "All" .

2. WorkingDays - another parameter entered by the end user which is used in a formula to forecast. Can I use the same parameter in formulas which will be located in the subreport? I've tried to create the formula but the parameter is not a listed field to use. Any way to get the number passed through to use in subreport formulas?

Sorry this is so long. Thanks to anyone who can help.

L
 
Hi,
As to the first part of your questioon:
Try testing for the ALL this way:

If {?BusinessUnit} = "All" then
True
else
If {?BusinessUnit}<> "All" then
totext({tbl_dw_Case_info.Business_UNIT}) = {?BusinessUnit}


//Just my preference for this..Database field = parameter
// if you can avoid converting, I would..


Not sure about the second part...

[profile]
 
You should reverse the method described by Turk to ensure SQL pass through to the database.

(
If {?BusinessUnit}<> "All" then
totext({tbl_dw_Case_info.Business_UNIT}) = {?BusinessUnit}
else
If {?BusinessUnit} = "All" then
True
)

You can pass values from a main report to a subreport (and back) by using shared variables, as in:

Main report formula (place in the report header before the subreport):

whileprintingrecords;
shared stringvar SomeValue:= {?MyParameter};

Subreport formula:
whileprintingrecords;
shared stringvar SomeValue;
SomeValue

You can then use it like any field.

You might also look at my FAQ on record selection formulas:

faq767-3825

-k
 
You could also create the parameters in the subreport, add them to the record selection formula or use them in formulas as you would in a regular report (however you are using the parm), and then in the subreport linking screen, add the main report parameter and in the lower left, use the dropdown in each case to select {?yourparm}, NOT
{?Pm-?yourparm}, which is the default display. In the first case, when you create the subreport parameter, be sure to add "All" to the default list.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top