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!

Subreport Question 1

Status
Not open for further replies.

metalteck

MIS
May 10, 2006
54
US
I am using crysal 8.5.
I have my main report that breaks down the productivity of a class by groups, 0-30, 31-60, etc.
Ex. Class 0-30 31-60 61-90
A 1.00 25.00 100.00

I have another report that breaks down the class based on budgets. Ex.
Class Budget
A 15,000

I placed the second report as a subreport to the main one, but what i would like to know is how I can get certain data from the subreport to appear in the main one.
I want the report to be able to look like this;

Class Budget 0-30 31-60 61-90
A 150000 5.00 25.00 60.00

Please help

 
Try linking SUB to the Main by Class. Right click on SUB (through Main) and link it. Then place your sub wherever you want in Main. Shrink it to fit. Good luck
 
I'm linking it by class, but now I don't get anything at all in the budget report.

The subreport is already in the main report and I clicked on it and linked it to the class field?

Do I need to place this somewhere other than in the report footer?
 
Place it in the group section for class--where you are placing your other summaries.

-LB
 
In the group header I am sorting it by class. Also along with class I amd calculating individual totals.

Then in the report footer, I am calculating the grand totals.
 
What is your question? Do you need to use the budget figure from the subreport in calculations? What do you mean by "along with class, I am calculating individual totals"? You should explain your entire report structure and what you are trying to do.

-LB
 
What I basically want to know is if I have a subreport in the main report,when I run the report, can I grab data from the subreport and put it into the main report?

Right now, when I run the main report, data returns from both the main report and subreport individually(unlinked). But when I link the subreport to the main report by the class field, nothing gets returned in the subreport.
 
Yes, you can, but first you need to figure out why the subreport isn't returning any records. If you go to edit->subreport links, is class moved to the right at the top of the screen, and {?pm-class} shown in the bottom left with "select data based on this field" checked and the class field shown below?

You also need to have the subreport positioned correctly. If linked, it must be in a group section for class.

You should also go into the subreport and check that the record selection formula shows something like:

{table.class} = {?pm-class}

-LB
 
When I run the subreport, it is asking me for a parameter.
If I hit enter, nothing returns, but If I enter a specific class, it returns. Is there a way I can get all of the classes to return without having to actually type each one in?
 
You shouldn't be trying to run the subreport on its own. Run the main report to see what the subreport returns.

-LB
 
I'm getting the values passed into the main report now.

My next question is how can i get the totals from the subreport and sum them up with the totals from the main report?
 
You are not providing adequate information. What is your report structure? Where have you placed the subreport? What do you want to total?

-LB
 
In the Group header, I have placed the subreport. Also, in the group header, I have the subtotals listed. Then in the group footer, the grand totals are listed. The details are surpressed.

Ex.

Class Budget 0-30 31-60 61-90 Totals
A 10000 15 25 100 10140
.
.
.
Gr Total 500000 2500 35000 9000 546500

I want to calculate the values in the subreport(Budget) with the rest of the productivity numbers. Is this possible?
 
I assume you mean the grand totals are in the report footer. In the subreport, create a formula:

whileprintingrecords;
shared numbervar budget := {yourbudgetfigure};

Place this formula in the subreport report footer.

In the main report, in a GH_b section or the GF section (a group section below the one in which the subreport is located), place a formula like this (suppressed):

//{@accum}:
whileprintingrecords;
shared numbervar budget;
numbervar totbudget := totbudget + budget;

Then in the report footer, place this formula:

//{@displaybudg}:
whileprintingrecords;
numbervar totbudget;

-LB
 
Okay, this exactly works the way I need it to. The only problem is if i have a 0 in the numbervar, when I try to add them all together, it will count the the previous record twice. Do you know how I can rectify this?
 
I assume you mean a 0 for the shared numbervar budget? If so, you need a reset formula in the main report:

whileprintingrecords;
shared numbervar budget := 0;

Place this in a section above the one in which the subreport is located. If the subreport is in GH_a then insert another GH section and in design mode, click on the gray area where it says GH_c (the new section) and drag it so that it is the topmost GH section (the new GH_a). Then add the reset formula there. The subreport is then in GH_b and the accumulation formula in GH_c.

-LB
 
Ok, I'm almost done. Now that I have the grand totals for the unbilled. How can I sum up all the totals across to get a grand total:
ex

Class Unbilled 0-30 31-60 Total
A 10000 25 25 10050

How can I get the total number?
 
I don't know what I'm seeing. Are these summaries at the class group level? e.g., like sum({@0-30},{table.class})? If so, then create a formula that adds them together:

whileprintingrecords;
shared numbervar budget;

budget + sum({@0-30},{table.class}) + sum({@31-60},{table.class})

-LB
 
yes, they are summaries at the class group level.

But what do you mean by {table.class}?



Class Unbilled 0-30 31-60 Total
A 10000 25 25 10050
B 20000 25 25 20050
C 30000 25 25 30050
 
When I enter the formula:

Whileprintingrecords;
shared numbervar budget;

budget + sum({@0-30}), + sum({@31-60})...

it returns blank...

any suggestions on how to get the grand totals?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top