Wrox Programmer Forums
|
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 November 27th, 2006, 11:37 AM
Registered User
 
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default How can I do this?? A loop?

This seems simple but I can't figure it out.

I'm pulling back a record set that shows all budgets entered for a company - the main items are EditedBy and Amount. So it might show:

EditedBy Amount
------------------
jsmith 1000.00
kjones 1500.00

So what I need to get is the change amount from one entry to the next to display on the page. Any ideas? Thanks in advance.



 
Old November 27th, 2006, 01:41 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by crapsolo
So what I need to get is the change amount from one entry to the next to display on the page. Any ideas? Thanks in advance.
Perhaps you can rephrase this so that we can better understand what it is you are requesting.

Woody Z http://www.learntoprogramnow.com
 
Old November 27th, 2006, 02:24 PM
Registered User
 
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry if I was unclear. I'd like to somehow dynamically pickup the amount the budget has changed with each edit. So after the "Amount" column, I'd like to have a "change amount" column. Using my example, the Change Amount column would show "$500.00" next to the 1500.00 since the budget increased from 1000.00 to 1500.00...

EditedBy Amount ChangeAmt
-----------------------------
jsmith 1000.00 --
kjones 1500.00 $500.00

 
Old November 27th, 2006, 02:53 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Okay - so, for each value in Amount, there is a Change Amount, which is the difference between the previous and current amount listed?
This is simple math. One way to do this, is as you loop through the records and create the display output, you must store the previous amount in a variable, do your math to get the change amount and add it to your display output, and then set the variable to the current amount to be used as the previous amount for the next record.



Woody Z http://www.learntoprogramnow.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with for-each loop athanatos XSLT 0 April 10th, 2006 07:20 PM
Do Until loop with IF crmpicco Classic ASP Databases 2 June 15th, 2005 05:35 PM
For....Loop kliu9 Excel VBA 5 February 10th, 2005 06:43 AM
Do Loop junemo Beginning PHP 8 July 28th, 2004 02:58 AM
nested while loop doesn't loop hosefo81 PHP Databases 5 November 12th, 2003 08:46 AM





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