Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Not being able to summarrize data Post Reply Post New Topic
Author Message
dsallow
Newbie
Newbie
Avatar

Joined: 10 Dec 2008
Location: United States
Online Status: Offline
Posts: 4
Quote dsallow Replybullet Topic: Not being able to summarrize data
     Posted: 10 Dec 2008 at 6:10am

OuchThe first calculation I need is called % of SLA Grand Total .

What i want to do is take the formula PercentofSLA_Func and sum all together and then divide by number of times within groups.  The formula = {@Prod_Func}/{tblQUESLA.SLA}*100

@Prod_Fun = Sum ({TblData.items}, {TblData.Func})/{@TimeInQue_Func}/{@Caluculate}

The individual Groups are working correctly but if i try to do something like this Sum( PercentofSLA_Func ) I get this error "This Field cannot be summarized"

The report has a total of 3 groups - User_id,que,Func
I only display calculations on the footer of group 3 (func)


Any and all help would greatly be appreciated.

 

Don S

Don Sallow
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 10 Dec 2008 at 6:31am
This is what I do in cases like this...
Create a shared variable that is set to 0 in the group header.  Then in your function, that is working, add a reference to the shared variable and update it as desired.  Lastly, in the group footer, display the shared variable, in your case do some math and then display. 
 
Hope this helps
IP IP Logged
dsallow
Newbie
Newbie
Avatar

Joined: 10 Dec 2008
Location: United States
Online Status: Offline
Posts: 4
Quote dsallow Replybullet Posted: 10 Dec 2008 at 6:36am
Can you provide an example of a shared variable.  The only variables I ever used was with the while printing records function.  In the page header i have a formula field called Initialize = Whileprintingrecords;
numbervar x:=0;
numbervar y:=0;
numbervar z:=0;
I then have a formula called calculate that does this
Whileprintingrecords;
numbervar y;

y:=Y + 1
 
 
 
Hope that gives more information
 
 
 
Don S
Cry
Don Sallow
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 10 Dec 2008 at 6:41am
Sure.  Shared variables are declared by putting the shared in front of the declaration.  I don't remember the scope, I know it is in Brian's book.
 
So the formula in the header would look like:
Shared NumberVar thisVar :=0;
""                 //I do this so that nothing displays and I can place my formula anywhere.
 
similarly, the footer formula would look like:
Shared NumberVar thisVar / theCount
 
Shared variables are really easy to use and very versatile.
 
Hope this helps
IP IP Logged
dsallow
Newbie
Newbie
Avatar

Joined: 10 Dec 2008
Location: United States
Online Status: Offline
Posts: 4
Quote dsallow Replybullet Posted: 10 Dec 2008 at 6:55am
Ok My question is when and how do i populate it with the different numbers that i want to sum
Don Sallow
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 10 Dec 2008 at 7:20am
How is the easier.   variableName := variableName + addsomething.
 
The something might be a SUM, Count, DistinctCount, or a field value from a data table.
 
When, is more complex.  Depends on what you are doing.  In your case, you are trying to get a number from a Group Footer to appear in a later group footer or report footer, so I would add the appropriate value that you will need for the calculation in the group footer formula...I would update my shared variable(s) that I will need later from the values in the formula for the group footer (which is working). 
 
Why in that formula?  Several reasons: 1) we know that it is working 2) It 'knows' what the values are as they may not be reproducable by other means, 3) It's easy--kind of like 2, why take the time to recalculate what has already been calculated.
 
What you are adding/keeping track of is up to you.  You know the report and the values, but when you need to use the values, they are available. Just put the formula that zeros out the variable in the header of the group that displays them/their final calculations.
 
Hope this helps
IP IP Logged
dsallow
Newbie
Newbie
Avatar

Joined: 10 Dec 2008
Location: United States
Online Status: Offline
Posts: 4
Quote dsallow Replybullet Posted: 10 Dec 2008 at 9:37am
That Worked.  I can not thank you enough.
 
 
Don
Don Sallow
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum