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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array Split ToNumber

Status
Not open for further replies.

aj3221

Technical User
May 14, 2008
79
US
Good morning!
I have an array field that has sales information in it. For example:
0;0;1;2;25;3;0;0;12;20;30;0

Each split represents a month (Jan-Dec respectively)...so in November they purchased 30.

I did the split of each section so I have each month broken out.

I want to get a ytd total so I added the splits together. The result I want is 93. What I'm getting is 0012253001220300.

I'm assuming it doesn't see my splits as numbers. I tried tonumber but I am doing something wrong I guess because it's not working.

Any help you can offer is greatly appreciated.

Thanks!
 
Try something like this:

stringvar array x := split({table.field},";");
numbervar j := ubound(x);
numbervar i;
numbervar tot:= 0;
for i := 1 to j do(
tot := tot + tonumber(x)
);
tot

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top