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

Passing multiple variables to a subreport selection criteria.. how?

Status
Not open for further replies.

Roadkill150

Programmer
Mar 8, 2002
242
US
Ok.. my issue is that i need to pass multiple variables to a subreport for selection purposes. here is my example
in the main report we have in the selection criteria: {cust.Lastname} in ["smith","johnson","jobob","etc"]
I need to pass the variables smith johnson jobob etc to the subreport. Shared variables only let me pass a single value between the two. The key here is that I may need to change the number of variables in the main report and need the subreports to reflect those changes. I initially thought of using strtok to pass a string in then separate it out, but strtok requires you to know how many ,'s you are using.
So.. how do i get all my variables to pass dynamically to the subreports?
 
You could use a split() function to convert the comma-delimited string into a shared array variable and pass that
shared variable to the subreport, or simply pass the string as a shared variable or a link formula and use the same 'IN' operator inside the subreport?

Cheers,
- Ido
ixm7@psu.edu
 
Hi Ido,
I will have to try the split function as that isn't an avenue i have tried yet. passing the string in as a shared variable doesn't work in that you need to have the "'s within the string and crystal won't allow that Seagate Certified RCAD Specialist.
-Bruce Thuel-Chassaigne
roadkill150@hotmail.com
 
If you have a front-end app in VB or ASP, it's doable.
 
unfortunately the site i am at is not using any sort of front end apps and this has to be able to run from a compiled report.. Thanks though! Seagate Certified RCAD Specialist.
-Bruce Thuel-Chassaigne
roadkill150@hotmail.com
 
One undocumented difference between CR8.0 and CR8.5 is that you now CAN link multivalue and range values between a main report and a subreport.

On CR8.0 it only passess the first value of the parameter.
On CR8.5 it sends the lot.

But I've never seen this listed anywhere - perhaps CD didn't want to admit it didn't use to work. Editor and Publisher of Crystal Clear
 
Do the variables have to be passed all at once? or one at a time? If one at a time then link on {cust.Lastname}

How are you passing these values of {cust.Lastname} by a user entered multiparameter?? Can you not link onto this parameter?
 
It is just variables, I am not using parameters in this case. The report I have has probably in the order of 15-20 subreports and what i am looking for is a way of passing the multiple variables from the main record selection to the subreports. I tried linking via the lastname table and it returns only the first name that is in my list of variables.. so Chelseatech and ngolem, I tried the linking on fields based on what my variables are calling for ie: lastname table so if the first name in my list is "smith" only smith returns on the subreport and none of the other values that are returning in the main report (perhaps they did not fix this in crystal then since i am using v8.5) Seagate Certified RCAD Specialist.
-Bruce Thuel-Chassaigne
roadkill150@hotmail.com
 
Well I don't think that Shared variables can be used in the record selection of a subreport

One trick I did use once was to creat a formula in my main report and used this as my linking to a subreport...but I don't think this can be done in your case since you appear to want to pass an array.

HOW ABOUT THIS

Create an SQL Expression of Lastname + FirstName in the main report as well as the subreports...I'll bet Crystal will allow linking on these expresions
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top