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

Using two subreports to get one parameter

Status
Not open for further replies.

DJWheezyWeez

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

I have a report with two subreports and I'm trying to get the Press from both and restrict it by that. Both subreports are identical with tables/formulas/restrictions except for one. Subreport A shows only StepNums 130 and 150. Subreport B shows only Stepnums 230 and 250. The way the data is in the system, if I used StepNums 130 and 150 for everything or StepNums 230 and 250 for everything, certain types of jobs would be wrong making me need to use two subs.

In my main report, I can see what type of job it is and make a formula to pick the Press from the specific subreport I want. The main report also has a Press field but gets the Press from the wrong place in the system, again making me use two different subreports. Currently, the report works fine if it is run for all Presses but when the user chooses a specific Press, it shows the Presses from the table in the main report which is wrong.

What I'm hoping to do is set up a parameter where the user chooses a Press or a few Presses and the report will look to the correct Subreport based on the type of job it is and return the correct Press.

If this isn't making sense, I can elaborate more but any help is appreciated.

-DJWW

 
Is there a relationship between the Press in main report and all the other Presses you want to select for the Subreports?

If yes you can use a background subreport, ie made as small as possible with all sections suppressed and can grow turned off.

Using the above relationship this can create and array listing all presses and then this array is passed to the subreports to show all relevant presses.

Ian
 
Ian,

There is a Press field in the main report but it displays the Press that is input during the estimating step when creating a Job. For whatever reason, the people that do the estimating either skip a step or just don't know what Press the Job will run on so it defaults to a certain Press. The Press fields in the subreports are from after the estimating step when the actual Press is input.

The short answer is no, there is no relationship.
 
If there is no relationship, how would the user know which Presses to enter.

can you have a multiple value Paramter where the first one is the Main Press.

In Main select

Press = {param}[1]

and in SRs use same para and exclude {param}[1]

(Press = {param} and Press <> {param}[1])

You create params with same name and type in main and SRs. Then in SR link place main param in main window and then in lower left hand drop down select param with same name in subreport.

Ian

 
It's not working but I'm probably doing something wrong. I created a new parameter {?Press} in the main report with the type = string. In the record selection, I used {table.Press} = {?Press}[1]. In both subreports, I made the same parameter {?Press} with the type = string. In the record selections for both subreports, I used {table.Press} = {?Press} and {table.Press} <> {?Press}[1]. Then I linked both subreports on that parameter and used the bottom left drop down to choose the same parameter from the subreports.

Originally I got nothing but then I figured out I needed to use [1 to 3] since most my Presses are 3 characters long. Not sure what to do if the Press is more or less than 3 characters long but that's a different issue.

I also noticed that if I type in 844 for my Press, it shows only Presses from the estimating step that are 844. I don't want those. Maybe I did a bad job of explaining but I'll try to clarify.

A Job should only have one Press but two are listed in the system. One Press gets inputed during estimating and another after estimating, during production I think. If no Press is put in during estimating, it defaults to a Press on its own. This shows up in my main report. Once a Job gets to production, its given a new Press, the actual Press. This shows up in my subreports. A Job may say it's going to run on the 844 Press when you look at the Press inut during estimating but might run on the 944 Press. It can also default to the 844 Press and actually run on the 844 Press so they may be the same and they may be different.

Currently, I have two subreports, one for Type A jobs, one for Type B. The only difference in the subreports is the StepNum that I mentioned earlier. In both subreports, I have a formula {@Press}:
Code:
//in subreport A
shared stringvar TypeA := {table.Press}
Code:
//in subreport B
shared stringvar TypeB := {table.Press}
In the main report, I use a formula {@Press}:
Code:
shared stringvar TypeA;
shared stringvar TypeB;
if {table.JobType} = "A"
then TypeA
else if {table.JobType} <> "A"
then TypeB
This displays the correct Press from the subreports since the Press from the table in the main report is wrong.

Normally I'd use a record selection ({table.Press} = {?Press}) but since the Press fields are in two different subreports, I'm having a problem getting it into one.

Hopefully this makes more sense.

-DJWW

 
You need to configure the parameter to allow multiple entries. Then you can add a list of Presses.

I thought that was what you wanted.

If you have cofigure the param as a single value then {?Press}[1] will return firts letter of string., whereas if param is mulitple value {?Press}[1] will return first of the list.

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top