?
Solved

How can you sum comma separated numbers within a string?

Posted on 2008-10-10
3
Medium Priority
?
460 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 101

Accepted Solution

by:
mlmcc earned 1000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

741 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