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

add shared variable and group summary

Status
Not open for further replies.

bluevelvet

Programmer
Jan 28, 2003
18
0
0
GB
Hi there, I have cr9 connecting to sql 2000. I have a shared variable in my mainreport from a sub report which calculates parts costs. This has been placed in the group footer of the main report which summarises the labour cost so I have job costs for labour and parts. I need to get the total job cost by adding the summarised labour and the shared variable(parts cost).

My formula for this:

{@PartsCost}+Sum ({@LabourCost}, {IPJOBM.JOB_NUMBER})

The result of this formula only has the labour cost and hasn't added the shared variable(parts cost)to it but it doesn't generate an error either. Any help with this would be much appreciated cos I'm really confused.....

Thanks :)
 
I don't see where you're using a shared variable in this formula, is it the @partscost?

The subreport needs to execute in a section prior to using the formula, and if it's group based, will need to be reset after each use within a GH or GF section. You can create new sections by right clicking them and selection new section below.

If you need further help, please post where your subreport is in the report (wasn't sure if you were saying that @partscost or the subreport was in the GF), example data, and expected output within the report.

-k
 
Sorry, didn't realise I hadn't said. Ok here goes:

Group1 grouped on job category
Group2 grouped on job number
Subreport is PartsCost
Shared Variable is @PartsCost
Formula to get the total job cost is:

{@PartsCost}+Sum ({@LabourCost}, {IPJOBM.JOB_NUMBER})

the subreport (ie PartsCost) and SumOfLabourCost are in GF2a
the formula (ie @PartsCost) is in GF2b

To clarify, the detail section of the report lists the labour costs for the job. The GF2a summarises the LabourCost and shows the PartsCost sub report. Then GF2b gives a total job cost by adding together the total labour costs and the @PartsCost(the shared variable).

Sorry I know this is confusing because I named the subreport and shared variable partscost, I can rename the shared variable if it would make it easier to follow.....

Thanks....
 
I think you have to declare the shared variable in the main report, so if your shared variable is "shared numbervar partscost" then try this as your formula:

shared numbervar partscost;
partscost + Sum ({@LabourCost}, {IPJOBM.JOB_NUMBER})

Not sure this is the issue, but it's worth a try...

-LB

 
Thanks LB but the @partscost is the formula which declares the shared variable. I did however try what you said anyway and it didn't work. The formula to add the labour and parts cost still appears to be ignoring the parts cost element and just gives me the labour cost.

I know the shared variable is returning data to my report because I have placed it in a group footer and can see the correct costs being returned by it. I just can't seem to use it in my formula to get a grand total for the job.

BV
 
It's ok, I fixed it by putting the shared variable into the GF on the subreport....

Thanks everyone :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top