Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Values together from same field 1

Status
Not open for further replies.

gavinjb

Programmer
Apr 24, 2003
106
0
0
GB
I have a field which returns 14 vaslues seperated by a comma, (eg 245.67,128.90,126.54,0,0,0,0,0,0,0,0,0,0,0). I need to be able subtract all these values and add them all together, does anyone have any ideas how this can be done.

Regards,



Gavin,
 
This should help, change the item in bold with your field :

Local StringVar Input := "245.67,128.90,126.54,0,0,0,0,0,0,0,0,0,0,0" ;
Local NumberVar Counter := 0;
Local NumberVar Output := 0;

Local StringVar Array Values := Split(Input,",");
While Counter <> UBound(Values) Do
(Counter := Counter +1;
Output := Output+ToNumber(Values[Counter]););
Output;

Enjoy...

Reebo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top