I need Horizontal sum in Crystal repo

Printed From: Crystal Reports Book — Forum Name: Talk with the Author


  Respected Sir/Mam,

     I am using Crystal report 9.2 and VB 6.0.

   I need horizontal sum of 9 fields.
   I havent any field in that i can store the sum of that 9 field.

Help me as soon as possible.

Thanking You,

Harshad Mahant
Create a formula.  If none of the fields can be null, it will have this type of syntax:
 
{field1} + {field2} + {field3} + ...etc.
 
If any of the fields can be null, then you'll have to do something like this:
WhilePrintingRecords;
Numbervar mySum;
If not IsNull({field1}) then mySum := {field1} else mySum := 0;
If not IsNull({field2}) then mySum := mySum + {field2};
If not IsNull({field3}) then mySum := mySum + {field3};
...(add the rest of the fields)...
If not IsNull({field9} then mySum := mySum + {field9};
mySum
It's important that you have the final "mySum" without the semi-colon at the end or else the number won't display.
 
-Dell