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

Totaling variables question

Status
Not open for further replies.

staceyn

Technical User
Nov 19, 2004
107
US
Hello,
I am using cr XI rel 2 with an informix database.
I have a main report grouped by color, item and class.
I have 3 subreports to bring in received data into the main report.
There are parameters to select certain items within a class.

The subreports are also grouped by color, item and class.
Each subreport is located in the appropriate section:
Color rec sub in gf3A
color details in gf3b
subreport linked by item and color

item rec sub in gf2a
item details in gf2b
subreport linked by item

Class rec sub in gf1a
class details in gf1b
subreport linked by class

I have the shared variables and reset formulas working properly for the color and item groups and am getting the correct values for these groupings.

However for the class level variable I am getting the total for the whole class instead of for the selected items within the class.

Example
item color class qty
123 black 1000 50
123 green 1000 10
item 123 total 60
456 white 1000 25
item 456 total 25
789 red 1000 75
item 789 total 75
class 1000 total 12458

Grand totals 285325


I would expect to see 160 as the class total.
Instead I am seeing 12458 which is the class total across all items within the class and 285325 as a grand total which is the grand total for all items instead of the selected items.

Any ideas on how to get the correct class and grand totals calculations? I am sure I am missing something simple somewhere.

Thanks,
Stacey
 
It sounds like you haven't added the parameter for item selection to the record selection formula within the class subreport.

-LB
 
LB - When I add the parameter for item on the class level subreport, I only get the value for the last item.
 
You should be adding the item parameter to the record selection formula within the subreport, and then linking the parameter in the main report to the parameter in the subreport, by using the dropdown in the lower left corner of the linking screen to select {?item}, not the default {?pm-?item}.

-LB
 
LB -
If I add the item parameter in the subreport and then try to change the record selection in the subreport to be {?item} = {Pm-?Style)I am getting an error that the array must be subscripted.

To be clear, you are suggesting creating a item parameter in the subreport. Then changing the sub report link to match the item parameter in the main report to the item parameter in the subreport, correct?

Thanks,
Stacey
 
I don't know the name of your item parameter, but I will call it {?item}. In the subreport, use a record selection formula like:

{table.item} = {?item}

Then use the dropdown in the lower left to select {?item} (Not {?pm-?item}) to link with the same parameter {?item}in the main report.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top