473,399 Members | 2,478 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,399 software developers and data experts.

Calculating, Calling & Printing return values ????

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

Feb 13 '06 #1
1 1384
>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.
Feb 18 '06 #2

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

Similar topics

2
by: Jody Burgess | last post by:
Hi; I am writing my first python program and would like to know how to change stdout to refer to my default printer or any other printer on my network. The other question is, Is there an API set...
20
by: Pierre Fortin | last post by:
Hi! "Python Essential Reference" - 2nd Ed, on P. 47 states that a string format can include "*" for a field width (no restrictions noted); yet... >>> "%*d" % (6,2) # works as expected ' ...
25
by: kie | last post by:
hello, i have a table that creates and deletes rows dynamically using createElement, appendChild, removeChild. when i have added the required amount of rows and input my data, i would like to...
0
by: Angelos Karantzalis | last post by:
Hi y'all, here's a tricky one: I've written a wrapper around a Com Interop-generated assembly in C#. It's called SDEHandler & implements a previously defined interface, so that I can use it as a...
1
by: Ray Z | last post by:
I would like to have someone to help me out with my program. Users are able to add items if they wish for the Monthly Claims Charges System. I did not manage to do the calculation part of the...
8
by: DanielJohnson | last post by:
I am reading K&R and right now in section 2.9 bitwise operators. I understood most of the simple things initially but getting stuck with the later part where different functions like getbits(),...
14
by: arnuld | last post by:
i have slightly modified the programme from section 1.5.1 which takes the input frm keyboard and then prints that to the terminal. it just does not run and i am unable to understand the error...
9
by: clintonb | last post by:
I'm looking for a way to calculate the number of days between two dates using standard C++ functions. Would it be as simple as just using the difftime() function and then dividing that result by...
88
by: santosh | last post by:
Hello all, In K&R2 one exercise asks the reader to compute and print the limits for the basic integer types. This is trivial for unsigned types. But is it possible for signed types without...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.