Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Calculate Total In Repeat Region

LEGEND ,
Jun 17, 2006 Jun 17, 2006
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


TOPICS
Server side applications
414
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 17, 2006 Jun 17, 2006
LATEST
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
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines