Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Maximum and Minimum values from a summed Formula p Post Reply Post New Topic
Author Message
Davey69
Newbie
Newbie
Avatar

Joined: 29 Nov 2013
Location: United Kingdom
Online Status: Offline
Posts: 4
Quote Davey69 Replybullet Topic: Maximum and Minimum values from a summed Formula p
     Posted: 10 Apr 2014 at 1:04am
Hello, I am currently using Crystal Reports 2008 which is getting its data from an Oracle database. I have looked into this at length and I have been unable to find the information I need. I have query about getting the Maximum and Minimum values from a given formula which totals 2 or more fields. A snapshot of the information I am using is:

Field1 = dB1.Left_Serious
Field2 = dB1.Left_Dangerous
Field3 = @Tester
Formula = @LeftTot

Fields 1+2 are the total score given by the Tester for each Left Test.

Test   Field1   Field2   Field3
1        2.0        4.0        J Adams
2        1.0        1.0        J Adams
3        1.0        0.0        S Grey
4        0.0        1.0        S Grey
5        5.0        0.0        D Jones
6        5.0        8.0        D Jones

The formula to get the Grand Total for each Tester’s Left Test uses a grouping by Tester:

@LeftTot
Sum ({dB1.Left_Serious}, {@Tester}) + Sum (dB1.Left_Dangerous}, {@Tester})

Using the above details we get:

J Adams = 8.0
S Grey = 2.0
D Jones = 18.0

The Maximum figure is therefore 18.0 and the minimum figure is 2.0 and the required difference is 16.0.

The problem I have is I cannot use the Maximum or Minimum commands as Crystal 2008 will not let you use the Summary Functions like Maximum on a formula that sums two fields. I know you could create a new aggregate field in the database which would solve the problem however I currently do not have administrator access to the databases and cannot create any new data tables or fields.

I have tried to get the ball rolling by using the following code in 3 new formulas:

@LeftTotGrpHdr
//This Formula needs to be placed into the Group Header to reset variable
WhilePrintingRecords;
NumberVar LEFTTL:=0

@LeftTotGrpFtr
//This Formula needs to be placed into the Group Footer to display variable
WhilePrintingRecords;
NumberVar LEFTTL

    
@LeftTotCr
//This Formula declares and works out Total Left Tests
WhilePrintingRecords;
Global NumberVar LEFTTL:=LEFTTL + {@LeftTot}
    
However when I try to use Maximum({@LeftTotCr}) in a new formula I still get the error message “This field cannot be summarised.”

Is there another way to do this?

Cheers

Daveyt
Cheers Beers
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