Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Calculating, Calling & Printing return values ????

Reply
Thread Tools

Calculating, Calling & Printing return values ????

 
 
David
Guest
Posts: n/a
 
      02-13-2006
Hi,

I have a problem with returning a value from an external function.....

My asp page is basically a list taken from a database.
A date record is written from the DB, then all the recordslinked to
that date are listed, then the next date, then the next series of
records, i.e.


< some text here > scheduled for 21/02/06

<record 1>
<record 2>
<record 3>
<record 4>

< some text here > scheduled for 28/02/06

<record 1>
<record 2>
<record 3>
<record 4>

----------------------------------------------------

Within the loop for each record within in each date, a calculation is
done as follows:

CALC = CALC + (RS("ProdCount") * RS("ShipQty"))

At the end of each record cycle within a date range, I want to print
the following, pending what the value of CALC is.

"<font color=dark orange>There are NO units scheduled for this week"

or

"<font color=dark orange>There are " & CALC & " units scheduled for
this week"
..

I think I need to call a function to do this because I whish to print
the result, next to each date header, which preceeds the actual
records, ...... & docalc(CALC) & .......

I created a function, docalc(CALC) in an include file, and assumed that
where I wish to print the result, I just call my function as follows
(which does not work yet ?)

Where & how should I place/create the variable 'CALC' and the function
below ?

<%
function docalc(CALC)
if isnull(CALC) or CALC = 0 then
return "<font color=dark orange>There are NO units scheduled for this
week"
else
return "<font color=dark orange>There are " & CALC & " units scheduled
for this week"
end if
end function
%>

What am I doing wrong. The end result should look something like this :

< some text here > scheduled for 21/02/06
There are 534 units scheduled for this week

<record 1>
<record 2>
<record 3>
<record 4>

< some text here > scheduled for 28/02/06
There are 1163 units scheduled for this week

<record 1>
<record 2>
<record 3>
<record 4>

< some text here > scheduled for 05/03/06
There are NO units scheduled for this week

< some text here > scheduled for 18/04/06
There are 532 units scheduled for this week

<record 1>
<record 2>
<record 3>
<record 4>

-------------------------------------------------------


Appreciate all your help
Thank You
David Gordon

 
Reply With Quote
 
 
 
 
Anthony Jones
Guest
Posts: n/a
 
      02-18-2006
>I think I need to call a function to do this because I whish to print
>the result, next to each date header, which preceeds the actual
>records, ...... & docalc(CALC) & .......


Instead of sending you html output to the Response for a set of records
append them to a string variable instead (this does mean you need to
generate all the output for records in inline script).

Once you have got to the end of a set of records your CALC value will be at
the correct value. You can now output the date and 'units scheduled'
preamble then write the html in the string variable to the response.

Clear the string variable and Calc value to start again for the next date.

Anthony.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
brochure printing,online yearbook,printing,books printing,publishing elie Computer Support 0 08-21-2007 05:52 AM
brochure printing,online yearbook,printing,books printing,publishing elie Computer Support 0 08-21-2007 05:50 AM
brochure printing,online yearbook,printing,books printing,publishing elie Computer Support 0 08-21-2007 05:28 AM
brochure printing,online yearbook,printing,books printing,publishing elie Computer Support 0 08-18-2007 10:11 AM
what value does lack of return or empty "return;" return Greenhorn C Programming 15 03-06-2005 08:19 PM



Advertisments