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

Text of a parameter from a subreport in the main report 1

Status
Not open for further replies.

DJWheezyWeez

Technical User
Jun 5, 2008
265
US
I'm using CR XI.

In my report, I have a subreport to bring in a Customer Name. In the subreport, I have a parameter for a Customer range. In the main report, I want to have some text in the PH saying "Customer: _______ to ________". Normally I would just put those parameters in the blanks but since the parameters I'm using are in a subreport, I don't know how to do this. Is there a way? Thank you in advance for any help.

-DJWW

 
In what main report section is the subreport located? Is it linked to the main report? On what fields?

-LB
 
I'm unclear on what should appear in your blanks--the customer code or the customer name?

-LB
 
I'll make a guess at what you want. The page might show T. Brawn, B. Brown, W. Brown, T Brownford, B. Bull. You want the page header to say T. Brawn to B. Bull

(Except that probably your report uses customer number and it would not be alphabetic.)

The only way I can see is to have a separate subreport in the page header. If you have five customers per page, it starts from the first customer and stops when it finds the fifth. It could display the details in the subreport report footer, no need to pass back. (Shared variables could do this if needed.)

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 10 & 11.5 with Windows XP [yinyang]
 
Please identify the datatype of the parameter(s) you have used in your subreport. If you used a range parameter, if you instead replaced it with start and end parameters, you could then create the same parameters in the main report, link them to the parameters in the subreport, and then access them directly in the main report for your formula.

-LB
 
Madawc, I may have been misleading since I said PH. I meant RH but it shouldn't matter for my problem. My Customer Names and Codes are both strings of letters, no numbers involved.

Lbass, the reports are linked on CustomerCode and I want to have the CustomerName show up in the blanks. Yes, they are two different fields. For example, if the CustomerName is Coca-Cola Enterprises, the CustomerCode might be COCACOLA. The parameters in the subreport are a start and end parameter that I'm using in the Record Selection formula as {table.CustomerName} in {?First Customer} to {?Last Customer}. Since I set the list of values to dynamic and choose the CustomerName field to have a drop down list in the subreport, won't I have to have the same dynamic parameter in my main report to link them?

-DJWW

 
I just tested this and it works. Place a copy of the subreport in the report header and remove all links to the main report and remove the selection criteria. Place the two parameters in the subreport report header and suppress everything else.

Leave the sub in the body of the report linked on the customercode field, and leave the selection formula in the subreport as is, something like:

{customer.code} = {?pm customer.code} and
{customer.name} in {?startname} to {?endname}

-LB
 
Thanks that worked but now I've come accross another problem. When I restrict by this, it only restricts within the subreport. If my Customer range is Coke to Pepsi, the report will still show all Customers. The only this missing is the CustomerName from the subreport. The JobCode and all other info is still there. I haven't tried it yet but I was thinking to do a shared variable (call it nullcust) and do something like isnull(nullcust) in the Section Expert for the section(s) I want suppressed. I'm not positive but I think you need to use a field inside isnull() and it won't let you use a variable. Will that work? Or is there another way around this?
 
I assumed you were getting the name in a subreport because it wasn't available in the main report. So how would you restrict the main report data if the field isn't there? Can't be done. Maybe you should be restricting your main report by using the customer code, and then add the Customer Name as the description field for the parameter so that the user can select based on the name, but the data is restricted in the selection formula based on the code. Why not add the name table to the main report for this purpose?
Then you don't even need a subreport.

-LB
 
I don't rememeber why I originally made the Customer Name a subreport rather than put it in the main report but it's probably because there are a lot of tables linked in this report that don't link well. The whole thing is made up of formulas and variables and once I got the numbers correct, I didn't want to mess them up by adding another table.

I actually found a way around it though. Since you can't use a variable in isnull(), I basically told the subreport, using a variable, to return a "0" if it wasn't in the selected range. Then in the main report, I suppressed the sections I needed to if that variable = "0". Hopefully this can help anyone that has a similar issue.

Thanks for all the help lbass.

-DJWW

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top