473,320 Members | 1,957 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Problem with asp loop........

Hi,

The data I am trying to print on the web looks as follows:

Date 1

Record 1
Record 2
Record 3

Date 2

Record 1
Record 2
Record 3

and onwards ..........................

This I have working fine.
I need to add a calculation into the page print, so the page looks
like:

Date 1 (There are 437 units this week)

Record 1
Record 2
Record 3

Date 2 (There are 821 units this week)

Record 1
Record 2
Record 3

PROBLEM:
The calculation is done by stuffing a variable at the end of the loop,
and then calling a function which prints either 'No Data' or 'There are
xxx units this week'

Because the calculation has to be done at the end of the record loop
before the date changes, when the page first loads, the first date
header always reads:

Date 1 (No Data)

Record 1
Record 2
Record 3

Which is true, because the code has not yet looped through that dates
records, and hence the calculation = 0. Except there is a value. How
can I get around this problem ??

The calculation for the 1st date in the recordset is always printed
against the 2nd date header and so on down the listing. This is
obvious, as on the second loop, the first calculation has been done,
and gets printed when the next date header is created.... :-(

Much confused. I have tried everything I know.

Thanks in advance

David

Feb 15 '06 #1
2 1354
David wrote on 15 feb 2006 in microsoft.public.inetserver.asp.general:
Because the calculation has to be done at the end of the record loop
before the date changes, when the page first loads, the first date
header always reads:

Date 1 (No Data)

Record 1
Record 2
Record 3


Safe your html code in a string and response.write that later:
s1 = "<br><br>Date 1"

'' start of loop

s3 = "<br><br>Record 1"

s3 = s3 & "<br>Record 2"

s3 = s3 & "<br>Record 3"

'' end of loop

s2 = "(computed result)"

response.write s1 & s2 & s3

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Feb 15 '06 #2
>
PROBLEM:
The calculation is done by stuffing a variable at the end of the loop,
and then calling a function which prints either 'No Data' or 'There are
xxx units this week'


Loop twice?

Build your output and output it at the end of the loop?

Where is the data coming from?
Feb 15 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Charles Alexander | last post by:
Hello I am new to php & MySQL - I am trying to retrieve some records from a MySQL table and redisplay them. The data in list form looks like this: Sample_ID Marker_ID Variation ...
4
by: JP SIngh | last post by:
Thanks to Manohar for writing the basic code for displaying the managers and the employees in a tree like structure. I have adapted the code below but it gives me an error "exception occcured"...
2
by: Xiaozhu | last post by:
I trid to use icc -axW to optimize the code, but it becomes much slower... 8sec/37sec before and after using this option. my cpu is Intel(R) Pentium(R) 4 CPU 2.40GHz the test code is just one...
5
by: Carmine Cairo | last post by:
Hi, I'm working on a project and today I've note a little problem during the compile fase. Here a little piece of code: // 1st version welldone = 0; size = p->getSize(); backbone = new...
8
by: Jeff | last post by:
Hello everybody, I was doing one of the exercises in the K&R book, and I got something really strange. Here's the source code: /* * Exercise 2-2 from the K&R book, page 42 */ #include...
47
by: fb | last post by:
Hi Everyone. Thanks for the help with the qudratic equation problem...I didn't think about actually doing the math...whoops. Anyway... I'm having some trouble getting the following program to...
8
by: koorb | last post by:
I am starting a program from a module with the Sub main procedure and I want it to display two forms for the program's interface, but when I run the program both forms just open and then program...
11
by: felixnielsen | last post by:
What i have is not even a real problem, but i hope someone can help anyway, but first a piece of code_ @code start const unsigned short Size = 2; // 2^N std::bitset<Size*Size*Size> YZ;...
1
by: Promextheus Xex | last post by:
First php post... Hi there, I'm writing some code for my website to list people listening to my music. I have a loop for an array that dosen't seem to display all people. most of the time it...
5
by: =?Utf-8?B?Z215ZXJz?= | last post by:
Hello, I am attempting to start a cmd.exe process and pass several .vbs scripts (with additional parameters) and then read the output from the scripts and make "notes" in a DataTable (the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.