Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 1st, 2005, 07:28 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default calculate the values up

how do i add up the values of a ASP variable?

it is within a loop, but i want it outputted after the loop ends...

<% segments = cdbl(count_trip_id)*cdbl(number_of_passengers) %>

is the variable

but how do i calculate the values up??

++ or * ???

Picco

__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
 
Old February 1st, 2005, 08:53 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Just have one variable, initialized to zero, that exists through the loop. If you want to add just 1 to it everytime, you have to do: var = var + 1. If you want it to contain a running total, you have to do var = var+ segments

Brian
 
Old February 1st, 2005, 10:05 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cochin, Kerala, India.
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

Unfortunately, the more efficient operators ++ and += are not available in classic ASP. You have to use

variable=variable+1
 
Old February 1st, 2005, 10:18 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

    segments = cdbl(count_trip_id)
    'response.write "Segments = " & segments & "<br>"

    trip_segments = cdbl(count_trip_id)*cdbl(number_of_passengers)
    'response.write "" & trip_segments & "<br>"

    all_segments = all_segments+trip_segments
    'response.write "All Segments = " & all_segments & "<br>"


================================================== =

Does the trick.

Thanks anyways guys.

Picco





Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculate values of different selectionlists vsempoux Java Basics 3 August 7th, 2008 10:25 AM
Calculate ivangr Visual Basic 2005 Basics 0 April 9th, 2006 04:39 AM
How to calculate cumulative values of query fields method Access 0 July 12th, 2005 08:53 AM
Access - calculate a cntrl/values from 2nd cntrl CongoGrey Access 3 April 8th, 2005 06:48 AM
Help me How to calculate minhtri VB How-To 4 June 8th, 2004 04:06 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.