Print Page | Close Window

I need Horizontal sum in Crystal repo

Printed From: Crystal Reports Book
Category: General Information
Forum Name: Talk with the Author
Forum Discription: Ask Brian questions about his books and give him your comments. Like the book? Hate the book? Have suggestions? Let me know!
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=10811
Printed Date: 03 May 2025 at 2:28pm


Topic: I need Horizontal sum in Crystal repo
Posted By: humillmca
Subject: I need Horizontal sum in Crystal repo
Date Posted: 11 Aug 2010 at 3:27pm

  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



Replies:
Posted By: hilfy
Date Posted: 17 Aug 2010 at 4:58am
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


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics



Print Page | Close Window