Skip to main content
Inspiring
June 17, 2006
Question

Calculate Total In Repeat Region

  • June 17, 2006
  • 1 reply
  • 440 views
Hi,

I need to calculate a total based on fields in a repeat region, these values
are stored in an SQL db, all are numeric and written in ASP.

fields are

TOTAL_COST VAT GRANDTOTAL (Page selects records based on
field parameter and displays in a repeat region)


At bottom of page need to show total sum like

TOTAL_COST(sum of above)
VAT(sum of above)
GRANDTOTAL(sum of above)

Thanks in advance
Simon


This topic has been closed for replies.

1 reply

Inspiring
June 17, 2006
Above your repeat region declare three values like this

<%
Dim TCost = 0
Dim VAT=0
Dim GTotal = 0
%>

Then inside the repeat region simply have a line like this

<%
TCost = TCost + recordset.fields.item("cost").value
%>

Finally where you want the numbers to display you would have the following
calculations

<%
VAT = TCost * .01
GTotal = TCost + VAT
%>

--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver

Valleybiz Internet Design
www.valleybiz.net

"Simon Gare" <sg@simongare.com> wrote in message
news:e71gpa$8la$1@forums.macromedia.com...
> Hi,
>
> I need to calculate a total based on fields in a repeat region, these
> values
> are stored in an SQL db, all are numeric and written in ASP.
>
> fields are
>
> TOTAL_COST VAT GRANDTOTAL (Page selects records based
> on
> field parameter and displays in a repeat region)
>
>
> At bottom of page need to show total sum like
>
> TOTAL_COST(sum of above)
> VAT(sum of above)
> GRANDTOTAL(sum of above)
>
> Thanks in advance
> Simon
>
>