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

Passing parameters to a subreport 1

Status
Not open for further replies.

KidFix

Programmer
Feb 7, 2002
60
US
Hello all

my report contains a sub report that uses a stored procedure. For the stored procedure to run it requires two parameters. How can I set it up so that my main report is passing values to these parameters automatically and the subreport isn't promting for values of these parameters on viewing?

I've tried editing the subreport links but any value I pass to the subreport seems to create a new parameter in that subreport and not let me pass the value to one of the stored procedures existing parameters

Any help would be greatly appreciated
Thanks
 
Create the links as above, then right click on the subreport and select edit. Then goto the sub report tab, goto Report > Selection Formulas > Record Selection Formulas

Then put your SP parameter = new link parameter.

Reebo
UK

Please Note - Due to current economic forcast and budget constraints, the light at the end of the tunnel has been switched off. Thank you for your cooperation.
 
Thanks Reebo,

what is the exact syntax I need to enter? I've tried both of these with no success (there are two paraneters to be passed to the subreport):

{?@P_Date} = {?Pm-@ConvertFromDate} AND {?@P_Date2} = {?Pm-@ConvertToDate};

{?@P_Date} = {?Pm-@ConvertFromDate};
{?@P_Date2} = {?Pm-@ConvertToDate};

neither parameter seems to get through, and internet explorer crashes when I veiw the report!

Thanks for your help
 
I would have thought
{?@P_Date} = {?Pm-@ConvertFromDate} AND {?@P_Date2} = {?Pm-@ConvertToDate};
would have worked.

Ok, try this instead, right click subreport, change sub report links. Select the field to link to in the right hand box, then in the Sub Report Parameter to Use box, see if you can select the SP parameter. Look real close as sometimes it looks like there is only one field to choose when really there is a couple of scroll arrows on the right hand side.

Let me know how you get on, and sorry my first suggestion didn't work...

Reebo
UK

Please Note - Due to current economic forcast and budget constraints, the light at the end of the tunnel has been switched off. Thank you for your cooperation.
 
aha! that did the job. You were dead right, the sp param was there all the time its just I thought there was only one item in the drop down

Thanks very much
 
Reebo, you get a star! I have spent HOURS trying to get this damned subreport/stored procedure deal work correctly and it wasn't until I read your comment about "Look real close as sometimes it looks like there is only one field to choose when really there is a couple of scroll arrows on the right hand side" that I discovered the SP parameter.

Yea!

JennieM
 
I have to agree with JennieM. My fellow employees are thinking I have suddenly aquired god like computer skills. We have doing double and triple duty parameter entry wise for far too long and now thanks to you Reebo we only enter once now. Thanks Byron
 
Thanks for the star Jennie [smile], and I'm glad I couls help you lordb and KidFix.

Reebo
UK

Please Note - Due to current economic forcast and budget constraints, the light at the end of the tunnel has been switched off. Thank you for your cooperation.
 
OK Reebo, I need help now!

I've got a report with 4 levels of grouping and start/end date parameters. In the 4th group I have a subreport, and the subreport calls out to an Oracle SP. I wanted to make sure I could get Crystal to work with the SP so the SP only had 1 IN parameter: an ID. Report works beautifully.

I changed the SP to require another IN parameter: a date. I want to pass in the start date parameter automatically, however when I refresh the report it prompts the user for 3 parameters: the 2 user date parameters AND the SP date parameter.

I tried both of your suggestions:

"Create the links as above, then right click on the subreport and select edit. Then goto the sub report tab, goto Report > Selection Formulas > Record Selection Formulas. Then put your SP parameter = new link parameter."

That method still requires that I enter all 3 parameters.

right click subreport, change sub report links. Select the field to link to in the right hand box, then in the Sub Report Parameter to Use box, see if you can select the SP parameter.

This method works for the ID, but it will not display the SP's date parameter. ACK! Any ideas?!?!

Thanks!
Jennie
 
Ok, a couple of things to check:

1. after adding the date parameter to the SP, have you opened the subreport and verified the database and saved?

2. is the Date Parameter definately a date type? You will only be able to choose parameters of the same data type as the field you are linking the sub report to.

3. If all else fails, try creating a test report linking to the SP and see if a new report can see both the parameters.



Reebo
UK

Please Note - Due to current economic forcast and budget constraints, the light at the end of the tunnel has been switched off. Thank you for your cooperation.
 
Reebo, once again, you ROCK, my friend! [2thumbsup]

My main params were set to value type "date", but the subreport params were set to "datetime". So I added a formula to convert my main params to "datetime" format, linked the formula fields to the subreport, and voilà!

I'd give you another star but it won't let me!

Jennie
 
Jennie,

No problem, one star is enough, otherwise my head won't fit through the door. [smile]

Reebo
UK

Please Note - Due to current economic forcast and budget constraints, the light at the end of the tunnel has been switched off. Thank you for your cooperation.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top