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!

Passing/Accessing Parameters in Subreport 4

Status
Not open for further replies.

HayesBMH

Programmer
Jul 27, 2007
7
US
I am using Crystal 8.5 and an OLE datasource. I have a subreport whose data is not linked to the data in the main report (basically the same report but one is for radiologists and the other is for residents). They both use the same parameters but the application the report will run from, PowerScribe, does not prompt for those in the subreport. I was trying to declare the parameters as shared variables, declare and pass them to the subreport, and then use them in the selection criteria for the subreport which would eliminate the need to prompt for them. From what I can tell, the shared variables have not yet been set at the time the selection criteria is evaluated so they are not available for use in the Select Expert.

I have also not been able to successfuly use the shared variable for the parameters such as doctor that allow multiple values or a range to be entered.

Any help would be greatly appreciated.
 
Click on the subreport and choose "change subreport links".

Highlight your variable in the right hand column.

Choose "select data in subreport based on field"

This will allow you use pass the variable down as a parameter used to constrain/select the data.

It won't effect the master/main report in any way.

-- Jason
"It's Just Ones and Zeros
 
Alternatively, you could replicate the Sub Report parameters in the main report.

Then in the linking dialog box, select the parameters from main report and link to parameters in sub report in window in bottom left hand side.

Ian
 
THANKS Jason and Ian!

I did use the Change Subreport Link option but instead of checking the "Select data in subreport based on field:" box, I unchecked it which created additional parameters in my subreport (pm-?XXXXX) that I was then able to use in the selection criteria and not have to prompt for input.

I had already tried replicating the same parameters in the subreport and the main report but I tried it again anyway. Unless I'm missing something, it does not work/does not include parameters in the list of fields to choose from on the left or right.

I still need a solution because for whatever reason, unchecking the box does not work on another report. PLEASE HELP!
 
If you create the parameters in both places, then in the subreport linking screen, lower left corner, use the dropdown to find {?Parm} instead of the default {?pm-?Parm}. Make sure the parameters are set to the same datatype.

-LB
 
I verified that the parameters in the main report and the subreport have the same name and are set to the same data type and options. In the subreport linking screen, the only item in the dropdown is the {pm-?Parm}. Does it matter which version of Crystal I'm using? I'm using 8.5. Please review the attachment and let me know if I'm still missing something or if there is another way to accomplish this.
 
 http://www.box.net/signup/collablink/d_17654212/3ec031bc49a38
Don't understand why you can not see them.

I have recently been using CR8.5 with OLE Db connection and it was working fine when linking parameters. Provided they were both the same data type. They do not have to have the same name, just makes it easier to manage.

Is the data source a Stored Procedure?

Are you sure you are scrolling to the bottome of the list. Sometimes CR only opens a stupidly small window and you can not see the link params at the bottom.

Ian

 
Did you remember to use the subreport parameter in the subreport's record selection formula area or at least somewhere on the subreport?

-LB
 
THANKS Ian! If you knew how many times I have gone back to the subreport link screen trying to figure out why I could not see the parameters, you wouldn't believe me! Even though it doesn't look like there are scroll bars there, I clicked and the parameter list showed up. "Stupidly small" definitely applies to something or someone here! Had I realized that I would not have had to start this thread. THANK YOU SOOOOOOOO MUCH! I'm going to start doing what I tell me children not to do and click on everything! So are my co-workers who looked at this for and with me!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top