Solved

How can you sum comma separated numbers within a string?

Posted on 2008-10-10
3
454 Views
Last Modified: 2010-04-21
I have a string field in my data base.  Examples are:
0;3;4;2;3;5;0
3;4;1;20;3;0;4

I want to create a field that shows the sum of this field.

Results:
17
35

Is there an easy way to do this?
0
Comment
Question by:benbelzer
3 Comments
 
LVL 3

Expert Comment

by:Spydergt
ID: 22692243
Are there always 7 numbers?  If so it may be easy to break it down trimming to the commas in a formula.
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 250 total points
ID: 22692339
Try this

WhilePrintingRecords;
Local StringVar Array MyNumbers;
Local NumberVar i;
Local NumberVar Total;

MyNumbers := Split({YourField},';');
For i := 1 to UBound(MyNumbers) do
    Total := Total + Val(MyNumbers[i];

Total

mlmcc
0
 

Author Closing Comment

by:benbelzer
ID: 31505231
Flawless... thank you!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
This video discusses moving either the default database or any database to a new volume.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now