Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Addition with fields Post Reply Post New Topic
Author Message
swatts
Groupie
Groupie
Avatar

Joined: 17 Mar 2010
Online Status: Offline
Posts: 83
Quote swatts Replybullet Topic: Addition with fields
    Posted: 26 May 2010 at 6:32am
I have fields like field1, field2, field3, etc...

Each field has a value of 1-5. I want to add each field...ie...

field1 + field2 + field3, etc...

Where I can get a total.

Any help would be appreciated.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 26 May 2010 at 6:34am
assuming they are numeric and all on the same row create a formula field and add then just as you were...
table.field1 + table.field2 + table.field3
 
If you have the possibility of any NULL values in ANY of the fields you are adding make sure to make the formula use 'Default values for nulls'
 
IP IP Logged
swatts
Groupie
Groupie
Avatar

Joined: 17 Mar 2010
Online Status: Offline
Posts: 83
Quote swatts Replybullet Posted: 27 May 2010 at 3:33am
They are considered a string but it will always be 1, 2, 3, 4, or 5 without an option to leave it blank.
IP IP Logged
swatts
Groupie
Groupie
Avatar

Joined: 17 Mar 2010
Online Status: Offline
Posts: 83
Quote swatts Replybullet Posted: 27 May 2010 at 3:45am
If I just: tonumber ({field1} + {field2})
I get the fields joined. 34 instead of 7.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 27 May 2010 at 3:49am
tonumber(field1) + tonumber(field2) + tonumber(field3) ...
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.031 seconds.