on 06-24-2010 10:52 PM
I have a table with 3 columns and I'm trying to sum the results of the 3 in the 4th column. But I'm confused as to how many formulas I need and where they go.
Putting the formula below in the Column 4 Details give a result that is only counting Column 3. I'm not sure if this is supposed to be running total.
Group Header: Col 1 Col 2 Col 3 Col 4 ____ Details: Text1 Text2 Text3 ColumnSum
My calculation formula (Crystal syntax):
WhilePrintingRecords;
numbervar x;
numbervar y;
numbervar z;
numbervar ColumnSum;
ColumnSum:= x + y + z ;
if {@Text1}="N/A" then ( numbervar x := 0 ; ) else if {@Text1}="Low" then ( numbervar x := 1 ; )...etc. ;
if {@Text2}="N/A" then ( numbervar y := 0 ; ) else if {@Text2}="Low" then ( numbervar y := 1 ; )...etc. ;
if {@Text3}="N/A" then ( numbervar z := 0 ; ) else if {@Text3}="Low" then ( numbervar z := 1 ; )...etc.
Thanks in advance for any help
Edited by: GenePoz on Jun 24, 2010 11:57 PM
Edited by: GenePoz on Jun 25, 2010 12:02 AM
Hi Gene,
If this is on the Detail section then you don't really need a running total but you will need the variables. Try this:
numbervar x;
numbervar y;
numbervar z;
numbervar ColumnSum;
ColumnSum:= x + y + z ;
if {@Text1}="N/A" then ( x := 0 ; ) else if {@Text1}="N/A" then ( x := 1 ; )...etc. ;
if {@Text2}="N/A" then ( y := 0 ; ) else if {@Text2}="N/A" then ( y := 1 ; )...etc. ;
if {@Text3}="N/A" then ( z := 0 ; ) else if {@Text3}="N/A" then ( z := 1 ; )...etc. ;
x + y +z;
The reason it only shows column 3 is because that's the last thing the formula evaluates. You need to tell have the formula sum the 3 columns.
Good luck,
Brian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.