Solved

How can you sum comma separated numbers within a string?

Posted on 2008-10-10
3
459 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 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

691 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