Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Calculating the sum of a text field. Post Reply Post New Topic
Author Message
CushingMT
Newbie
Newbie


Joined: 08 Oct 2008
Location: United States
Online Status: Offline
Posts: 8
Quote CushingMT Replybullet Topic: Calculating the sum of a text field.
     Posted: 08 Oct 2008 at 11:45am

If I have a text field setup in an Access database, and I want Crystal Reports to calculate the sum, based on the text, is that possible?  Currently, I have each of the problem type variables listed separately in the database table, so the report calculates the sum, since a number is entered into that field.   I want to create a text field titled Problem Type, with a drop down box where the variables are listed.  In the report however, I will need to break down each problem type and the sum of those types.   

IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 08 Oct 2008 at 12:09pm
You are going to need to create a formula for each type that needs to be summed. That formula will return a value only if the type matches. It would be something similar to this formula:
Global NumberVar Type1;
if {table.ProblemType} = "your data goes here" then
   Type1 := Type1 + {table.fieldtosum};
Type1;
You will have to tweak this to use your own fields and values, but this should give you the right idea of what to do. My Encyclopedia book has three chapters on how to create formulas using Crystal syntax and it has sample code that you can use in your own reports. You can find out more about my books at Amazon.com or reading the Crystal Reports eBooks online.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
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