How to add my (totalowed) fields using Java or VB Sscript

What is a simple way to add these Fields called (totalowed)
<%
Var (totalowed)
%>

<% = FormatCurrency (totalowed) %>
adspaceAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cmalakarCommented:
what is "totalowed" ..?

Which fields to add.. ?
0
adspaceAuthor Commented:
its a field that holds a currency value
0
cmalakarCommented:
Can u explain it ?

Actually question is not clear.. ?

What types of objects do you want to add.. ?
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

adspaceAuthor Commented:
I need to add all the (totalowed) fields.  There may be 20 fields or there my be one.  but always at lesat one.  Is there a way to simply add all the (totalowed) fileds.  That is the only field but usually there are several.  
0
adspaceAuthor Commented:
I need the totals  say if there are 2 (totalowed) fields one with $1.15 and the other with $2.10 I need the script to return $3.25
0
cmalakarCommented:
Is totalowed  a String type.. ? or Float type ? or Int type.. ? ..etc
0
adspaceAuthor Commented:
I am not sure but it is a ASP page that is returning a customers billing information for the month ..thats why there are several (totalowed) that need to be added .....here is part of it
sMsg = sMsg & "<td><b>Total Amount Owed:</b></td><td>" & rs("TotalOwed") & "</td>"
0
adspaceAuthor Commented:
I remember years ago playing with some java and it was either dim or var the field name (totalowed) and it would add all the fields and return the count.  I dont know if did actual or rounded the number but we need actual.
0
cmalakarCommented:
Without type it is not possible to answer the question..!

Assuming you have a String array of totalowed, where each element contains an integer value in String

Then you can do the following

int total = 0;
for( int i = 0; i < totalowed.length(); i++)
{
    total = total + Integer.parseInt(totalowed[i]);
}

//total contains the totalled amount
0
adspaceAuthor Commented:
Nope that did not work
0
adspaceAuthor Commented:
oh its a string ...sorry
0
cmalakarCommented:
Instead of int, use float..
hope it works..

ie.,

float total = 0;
for( int i = 0; i < totalowed.length(); i++)
{
    total = total + Float.parseFloat(totalowed[i]);
}

If it didn't work.. Give the sample output of "totalowed" variable value...
0
adspaceAuthor Commented:
I can not get the last one to work either
humm
0
adspaceAuthor Commented:
This may not be the way to handle this properly ...I may need to look at another method to collect the total owed data....thanks for all your help
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.