Adding two formulas in Crystal Reports

Viewed 44

I know I'm not connecting something somewhere, so I need your help.

I have made calculations in each formula and now need to add them together - simple, but not. haha

Here is my code:

Group 1 - student Group 2 - class Group 3 - StudentWorkList_.Excuse Type (which is divided by Absent and Tardy)

I have to add the Absences and Tardies together, but for every 3 tardies = 1 Absent.

The calculations come out correctly for each one separately, but I can't add the Absence formula + the Tardy to Absent formula.

Creating another formula with Absent + Tardy to Absent does nothing...

Formulas:

Absent: if GroupName ({StudentWorkList_.Excuse Type}) = "Absent" then Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type})/76*100

Tardy to Absent: if GroupName ({StudentWorkList_.Excuse Type}) = "Tardy" then if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 3 then 1 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 4 then 1 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 5 then 1 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 6 then 2 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 7 then 2 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 8 then 2 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 9 then 3 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 10 then 3 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 11 then 3 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 12 then 4 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 13 then 4 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 14 then 4 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 15 then 5 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 16 then 5 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 17 then 5 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 18 then 6 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 19 then 6 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 20 then 6 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 21 then 7 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 22 then 7 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 23 then 7 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 24 then 8 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 25 then 8 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 26 then 8 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 27 then 9 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 28 then 9 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 29 then 9 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 30 then 10 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 31 then 10 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 32 then 10 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 33 then 11 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 34 then 11 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 35 then 11 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 36 then 12 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 37 then 12 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 38 then 12 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 39 then 13 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 40 then 13 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 41 then 13 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 42 then 14 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 43 then 14 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 44 then 14 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 45 then 15 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 46 then 15 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 47 then 15 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 48 then 16 /76100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 49 then 16 /76*100 else if Count ({StudentWorkList_.Excuse Type}, {StudentWorkList_.Excuse Type}) = 50 then 16

2 Answers

Create a simple detail level formula called {@Absence_Equivalent} using an expression such as:

IF {StudentWorkList_.Excuse Type}) = "Absent" Then 1
ELSE IF {StudentWorkList_.Excuse Type}) = "Tardy" Then 1/3
ELSE 0

Then, SUM that formula at any grouping or grand total level you wish.

Option 1: Create a formula that divides the sum by 76 -- that seems like the simplest approach. If for some reason you don't want to do that, then:

Option 2: divide the detail level value by 76. For example,

IF {StudentWorkList_.Excuse Type}) = "Absent" Then 1/76
ELSE IF {StudentWorkList_.Excuse Type}) = "Tardy" Then 1/228
ELSE 0
Related