[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 194
  • Last Modified:

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) %>
0
adspace
Asked:
adspace
  • 9
  • 5
1 Solution
 
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 new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
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

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 9
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now