Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: ADD numbers stored as string Post Reply Post New Topic
Author Message
verniqueb
Newbie
Newbie


Joined: 04 May 2009
Location: United States
Online Status: Offline
Posts: 12
Quote verniqueb Replybullet Topic: ADD numbers stored as string
    Posted: 25 Feb 2010 at 10:20pm
I need help in summing the values in a field that is seperated by commas.    The numbers are stored as string so I think I will need to convert the value to number after I have seperated each value.  For example:
2589.32,45897.12,4578,7893.03 =>(2589.32+45897.12+4578 +7893.03) =60957.47  
1235.02 ,45933.12,0,0,0,0,10.05 => (1235.02+45933.12+0+0+0+0+10.05) =47190.07
how would you suggest i go about creating a function to get the sum of each field?  do crystal have a built in function that i could use to calculate this for me?
Thanks in advance for your help and suggestions.
VB
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 26 Feb 2010 at 5:04am
Do the fields always have the same number of entries?
 
If so, I would use the split function. So something like this:
 
cdbl(split({table.field}, ',' )[1])
+
cdbl(split({table.field}, ',')[2])
+ etc.......
 
If they don't, I'm not really sure. Maybe someone else could answer that.


Edited by FrnhtGLI - 26 Feb 2010 at 5:05am
IP IP Logged
verniqueb
Newbie
Newbie


Joined: 04 May 2009
Location: United States
Online Status: Offline
Posts: 12
Quote verniqueb Replybullet Posted: 26 Feb 2010 at 7:57am
Yes, the fields always have the number of entries.   Do I need to write it in the form of a function or just how it posted in your response?
 
Thanks for your help Smile
 
VB
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 26 Feb 2010 at 10:16am
You can write it just like I have it, being sure to account for all numbers in the field.
IP IP Logged
verniqueb
Newbie
Newbie


Joined: 04 May 2009
Location: United States
Online Status: Offline
Posts: 12
Quote verniqueb Replybullet Posted: 26 Feb 2010 at 3:52pm
Okay great.  Thanks for your help.
VB
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.015 seconds.