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!

summing up value from group header into group footer

Status
Not open for further replies.

Crystal1Report

Programmer
Jan 19, 2011
8
NO
Hello,
I am new about sharedvalue formula. I have three groupings. And I suppress detail sections. All fields displayed in group #3 (by using formula, running total, etc from the detail section). I want to add value from one field from group header #3 and put a sum into group footer #2. The grouping is like Department (G#1), Menu (G#2), and Menu choice (G#3). Remember that I can't use the summary function from right clik - Insert... since I got the field into groupheader (#3) after using different formulas. What I need is just add the values displayed in different rows of the group header(Group header G#3 row 1 + Group header G#3 row 2 +Group header G#3 row 3, etc etc) and put the result group footer(#2)or Group header (#2). Is there anyone help me....

Actually I tried sharedvariable like
Group header-- G#2
Whileprintingrecords;
Global numbervar Total:=0

//I don't know where I put this.

whileprintingrecords;
Global NumberVar Total:={@Numberorder};
numbervar Maxnumberordered := Maxnumberordered + Total;
Total
//When I put in the Group header #3 then it adds the menu
//#1 sum into menu #2. But what I want is all
//menu must get their own sum. And at the end all sum from each menu will put together on parent department group footer(menu#1 + menu#2 + menu #3...)

Group footer--G#2
whileprintingrecords;
Global numbervar Maxnumberordered;
 
Take a look at Crosstab. I think it would do what you're wanting with much less work.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
My report has sub reports. So it is a bit hard for me to use cross tab here. I need the above formulas on main report
 
Your middle formula should be placed in the Group #3 section where your {@numberorder} formula is, assuming this is some kind of G#3 summary.

Please show the content of {@numberorder} and of any nested formulas. Also please show some sample data and identiy the sections and label the fields.

Why are the subreports relevant? Are values from the subreport being used in any of the formulas you are trying to summarize?

-LB
 
Right, my middle formula is already placed in the group #3 but by any means the group header #2 doesn't reset and get value 0 when the other menu on place. That is really my big confussion. I belive "at least logically" correct what I did.
{@numberorder} is a formula field of Maximum({command.fielda}, {Command.fieldb}).
eg.
Fieldb Fielda
Egg 1
Egg 2
Bread 2
Bread 3

Then my formula of @{numberorder} gives me
Egg 1
Bread 2
This is what am planning to get from @{numberorder} formula. And that is no problem since it is from detail section and that is directly from the sql query.

The subreports has no connection with these formulas. I have done all what I supposed to do on subreports and that works very fine.

 
Just realized--your reset formula should be:

whileprintingrecords;
Global numbervar Maxnumberordered := 0;

-LB
 
I can't belive this. It works. OMG it took me almost a week. I didn't realize that.

I really appreciate and thank you for your kind cooperation, lbass.
 
lbass,

One more question.

Is there a possibility to put this sum into groupheader? I need this for other report. And our customers need to see the sum on each group in the header.
fore example:

Group header--G#2
whileprintingrecords;
Global numbervar Maxnumberordered;

But in which group or where the reset formula shall place? And do you think it counts correct? I tried several times with different ways but got no solution.
 
No, you can't use running totals in the group header, since they haven't yet been accumulated.

Your earlier post seemed to show you were actually using a minimum, not a maximum, but whatever the summary, if you created it in a SQL expression, you could then summarize the summary in group headers by simply inserting sums on it at the group level and dragging the result into the group header.

-LB
 
No inserting sum is not working on this case actually. That gives me the total amount instead. What I need is to sum only (one row)of the minimum (start) and Maximum(End)from each group in a separate column.And mind you this report also has several groupings. So what I want to put in the group header is that the sum of several rows of fieldminimum from different group and put the result into parent group header. It is a bit complicated. If there is a possibility then good otherwise I will put on the group footer.

Thank you really.
 
Okay, yes, I see what you mean. I think you would have to save the current report as a subreport and then add it into the group header in order to accomplish this.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top