## Sum of integer in table with .dbf format

15 pts.
Tags:
Integer
Substring
I have table with .dbf format..inside only have 30 records which are 239,45,340,...etc. I wan to sum the integer like this..for example the first number..239=2+3+9=14..and the second number 4+5=9..then the output is 14,9,...until the 30th number..How would i do it? Help is desperately needed..I only know few tips..which are using for loop and substring...

Thanks. We'll let you know when a new response is added.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

## Discuss This Question: 2 Replies

Thanks. We'll let you know when a new response is added.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
• What programming language are you using?

Since you know substring and loop, you can loop through and sum each number in the data field. Then have and output field where you substring the result. When you are done with the first loop, you can determine the length of the answer by IF statements. If answer < 10, Length = 1. If Answer < 100, Length = 2. Etc.

Now you can value of length when you substring populating your final output field.

report
• Sorry i forgotten to mention my programming..its Microsoft Visual Foxpro 9.0