I have an ASP report that returns values from a SQL database and
formats the data in an HTML table.
I am trying to figure out a good way of using CSS to highlight the
table row that contains the highest value returned.
I tried storing the values in an array, and then used a function to
find the highest value. This worked, but then I couldn't really
figure out how to "tell" the report to highlight that highest value.
Could anyone think of an easier way?
Thanks! 5 1662
"cmt" <ch********@gmail.comwrote in message
news:47**********************************@26g2000h sk.googlegroups.com...
>
I have an ASP report that returns values from a SQL database and
formats the data in an HTML table.
I am trying to figure out a good way of using CSS to highlight the
table row that contains the highest value returned.
I tried storing the values in an array, and then used a function to
find the highest value. This worked, but then I couldn't really
figure out how to "tell" the report to highlight that highest value.
Could anyone think of an easier way?
Thanks!
Bob's suggestion is the most straightforward way to approach this, but you
may have reasons for ordering the results according to a different column.
If so, when you are looping through the array to write the <tr>'s out,
simply add an If statement that tests if the current row contains the
highest value. Asuming that your iterator for the for... next loop on the
array is i, and the first column contains the value to test:
Response.Write "<tr "
If arr(0,i) = myHighestValue Then Response.Write "style='background-color:
red;'"
Response.Write ">"
--
Mike Brind
Microsoft MVP - ASP/ASP.NET
On Apr 29, 3:29 pm, "Mike Brind [MVP]" <paxton...@hotmail.comwrote:
"cmt" <chrismt...@gmail.comwrote in message
news:47**********************************@26g2000h sk.googlegroups.com...
I have an ASP report that returns values from a SQL database and
formats the data in an HTML table.
I am trying to figure out a good way of using CSS to highlight the
table row that contains the highest value returned.
I tried storing the values in an array, and then used a function to
find the highest value. This worked, but then I couldn't really
figure out how to "tell" the report to highlight that highest value.
Could anyone think of an easier way?
Thanks!
Bob's suggestion is the most straightforward way to approach this, but you
may have reasons for ordering the results according to a different column.
If so, when you are looping through the array to write the <tr>'s out,
simply add an If statement that tests if the current row contains the
highest value. Asuming that your iterator for the for... next loop on the
array is i, and the first column contains the value to test:
Response.Write "<tr "
If arr(0,i) = myHighestValue Then Response.Write "style='background-color:
red;'"
Response.Write ">"
--
Mike Brind
Microsoft MVP - ASP/ASP.NET
Mike, would this work if I am populating the array in the recordset
loop?
Right now, I have objRs in a loop that populates each <tdhas it goes
through the loop. As each value is read via ObjRs, I also add that
value to the array. So the array is not fully populated until the
objRs is finished getting all the data.
Here is a sample of what the code structure looks like:
<table border="1">
<%
h = 0 'hitArray counter
objRs.Open strQry, dbLocation, 1
Do While Not objRs.EOF And Not objRs.BOF %>
<tr>
<td><% Response.Write objRs("urlName")%></td>
</tr>
<tr>
<td><% Response.Write objRs("urlDescription")%></td>
</tr>
<% h = h + 1
ReDim Preserve hitArray(h)
hitArray(h) = (objRs("NumberofHits")) %>
<tr>
<td><% Response.Write objRs("NumberofHits")%>
</tr>
Loop
objRs.Close%>
So the array works...it populates with all of the needed data. But it
is not finished populating until the loop is done running its course.
So I don't think there is a way I could test to see if
objRs("NumberofHits") is the maximum value everytime I write it out.
I hope that makes sense!
Thanks!
"cmt" <ch********@gmail.comwrote in message
news:53**********************************@w7g2000h sa.googlegroups.com...
On Apr 29, 3:29 pm, "Mike Brind [MVP]" <paxton...@hotmail.comwrote:
>"cmt" <chrismt...@gmail.comwrote in message
news:47**********************************@26g2000 hsk.googlegroups.com...
I have an ASP report that returns values from a SQL database and
formats the data in an HTML table.
I am trying to figure out a good way of using CSS to highlight the
table row that contains the highest value returned.
I tried storing the values in an array, and then used a function to
find the highest value. This worked, but then I couldn't really
figure out how to "tell" the report to highlight that highest value.
Could anyone think of an easier way?
Thanks!
Bob's suggestion is the most straightforward way to approach this, but you may have reasons for ordering the results according to a different column. If so, when you are looping through the array to write the <tr>'s out, simply add an If statement that tests if the current row contains the highest value. Asuming that your iterator for the for... next loop on the array is i, and the first column contains the value to test:
Response.Write "<tr " If arr(0,i) = myHighestValue Then Response.Write "style='background-color: red;'" Response.Write ">"
-- Mike Brind Microsoft MVP - ASP/ASP.NET
Mike, would this work if I am populating the array in the recordset
loop?
Right now, I have objRs in a loop that populates each <tdhas it goes
through the loop. As each value is read via ObjRs, I also add that
value to the array. So the array is not fully populated until the
objRs is finished getting all the data.
Here is a sample of what the code structure looks like:
<table border="1">
<%
h = 0 'hitArray counter
objRs.Open strQry, dbLocation, 1
Do While Not objRs.EOF And Not objRs.BOF %>
<tr>
<td><% Response.Write objRs("urlName")%></td>
</tr>
<tr>
<td><% Response.Write objRs("urlDescription")%></td>
</tr>
<% h = h + 1
ReDim Preserve hitArray(h)
hitArray(h) = (objRs("NumberofHits")) %>
<tr>
<td><% Response.Write objRs("NumberofHits")%>
</tr>
Loop
objRs.Close%>
So the array works...it populates with all of the needed data. But it
is not finished populating until the loop is done running its course.
So I don't think there is a way I could test to see if
objRs("NumberofHits") is the maximum value everytime I write it out.
I hope that makes sense!
Thanks!
Right. I assumed that you were already using GetRows() to create an array
from the recordset, then looping that to establish the highest value before
looping it again to write out your html string. That's probably what I
would do.
--
Mike Brind
Microsoft MVP - ASP/ASP.NET
On Apr 30, 3:30 pm, "Mike Brind [MVP]" <paxton...@hotmail.comwrote:
"cmt" <chrismt...@gmail.comwrote in message
news:53**********************************@w7g2000h sa.googlegroups.com...
On Apr 29, 3:29 pm, "Mike Brind [MVP]" <paxton...@hotmail.comwrote:
"cmt" <chrismt...@gmail.comwrote in message
>news:47**********************************@26g2000 hsk.googlegroups.com...
I have an ASP report that returns values from a SQL database and
formats the data in an HTML table.
I am trying to figure out a good way of using CSS to highlight the
table row that contains the highest value returned.
I tried storing the values in an array, and then used a function to
find the highest value. This worked, but then I couldn't really
figure out how to "tell" the report to highlight that highest value.
Could anyone think of an easier way?
Thanks!
Bob's suggestion is the most straightforward way to approach this, but
you
may have reasons for ordering the results according to a different
column.
If so, when you are looping through the array to write the <tr>'s out,
simply add an If statement that tests if the current row contains the
highest value. Asuming that your iterator for the for... next loop on
the
array is i, and the first column contains the value to test:
Response.Write "<tr "
If arr(0,i) = myHighestValue Then Response.Write
"style='background-color:
red;'"
Response.Write ">"
--
Mike Brind
Microsoft MVP - ASP/ASP.NET
Mike, would this work if I am populating the array in the recordset
loop?
Right now, I have objRs in a loop that populates each <tdhas it goes
through the loop. As each value is read via ObjRs, I also add that
value to the array. So the array is not fully populated until the
objRs is finished getting all the data.
Here is a sample of what the code structure looks like:
<table border="1">
<%
h = 0 'hitArray counter
objRs.Open strQry, dbLocation, 1
Do While Not objRs.EOF And Not objRs.BOF %>
<tr>
<td><% Response.Write objRs("urlName")%></td>
</tr>
<tr>
<td><% Response.Write objRs("urlDescription")%></td>
</tr>
<% h = h + 1
ReDim Preserve hitArray(h)
hitArray(h) = (objRs("NumberofHits")) %>
<tr>
<td><% Response.Write objRs("NumberofHits")%>
</tr>
Loop
objRs.Close%>
So the array works...it populates with all of the needed data. But it
is not finished populating until the loop is done running its course.
So I don't think there is a way I could test to see if
objRs("NumberofHits") is the maximum value everytime I write it out.
I hope that makes sense!
Thanks!
Right. I assumed that you were already using GetRows() to create an array
from the recordset, then looping that to establish the highest value before
looping it again to write out your html string. That's probably what I
would do.
--
Mike Brind
Microsoft MVP - ASP/ASP.NET
Mike,
So I would setup the array like this...assuming CheckMaxValue is a
function that checks the value against hitArray to see if it is the
maximum value?
h = 0 'hitArray counter
objRs.Open strQry, dbLocation, 1
hitArray = GetRows() 'this array now contains all the rows
from the strQry??
Do While Not objRs.EOF And Not objRs.BOF %>
<tr>
<td><% Response.Write objRs("urlName")%></td>
</tr>
<tr>
<td><% Response.Write objRs("urlDescription")%></td>
</tr>
<tr>
<td><% Response.Write CheckMaxValue(objRs("NumberofHits"))%>
</tr>
Loop
objRs.Close%>
Thanks!
"cmt" <ch********@gmail.comwrote in message
news:c2**********************************@y38g2000 hsy.googlegroups.com...
So I would setup the array like this...assuming CheckMaxValue is a
function that checks the value against hitArray to see if it is the
maximum value?
h = 0 'hitArray counter
objRs.Open strQry, dbLocation, 1
hitArray = GetRows() 'this array now contains all the rows
from the strQry??
Do While Not objRs.EOF And Not objRs.BOF %>
<tr>
<td><% Response.Write objRs("urlName")%></td>
</tr>
<tr>
<td><% Response.Write objRs("urlDescription")%></td>
</tr>
<tr>
<td><% Response.Write CheckMaxValue(objRs("NumberofHits"))%>
</tr>
Loop
objRs.Close%>
Thanks!
hitArray = objRS.GetRows() <-- now hitarray holds the values from objRS.
So, you can now close objRS, because you have no need of it anymore. You
will need to test if there are any records/elements in hitArray, which you
can do with IsArray():
If IsArray(hitArray) Then
'start looping through it as many times as you need.
--
Mike Brind
Microsoft MVP ASP/ASP.NET This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Andrew DeFaria |
last post by:
I created the following .sql file to demonstrate a problem I'm having.
According to the manual:
If |ON DELETE CASCADE| is specified, and a row in the parent table
is deleted, then InnoDB...
|
by: Athanasius |
last post by:
Could someone shed some light as to why the following setTimeout
function will not work on the Mac IE5.2? It does however work on
PC(Forefox,Netscape,IE) & Mac(Safari,Firefox). Here is the script,...
|
by: Homer Simpson |
last post by:
Hi All,
I'm trying to write a method where I pass three arguments and the method
returns six values. All the values will be doubles. First, is it possible to
get multiple values returned by a...
|
by: Chris Davoli |
last post by:
The folllowing will round to 526, but it should round to 527. It works
correctly for all other numbers, except for this one. Does anybody know of a
bug in Math.Round?
Dim ldecWater As Decimal =...
|
by: Peter Newman |
last post by:
Im still struggling to get this executing a stored proc working .. im
running vb.net (2003) and SQL 2005.. the story thus far is with a lot of
help and a prevailing wind i have come up with the...
|
by: kamin |
last post by:
I have this query
select
created_date,
tyg_aging_due_dates.object_type,
tyg_aging_due_dates.due_date
from
#tyg_aging_service_metrics
right join
tyg_aging_due_dates
|
by: hawaiijeff |
last post by:
I am writing an order receiving application in Access 2000. In this app you type in the tanker number the app looks that up in a table and should return just one row. The code below is showing how...
|
by: Philluminati |
last post by:
I am writing a poker game which needs to work with cash. I am aware
that there are problems with floats that make them unsuitable for
storing money values. On top of this I may be expected to do...
|
by: gigonomics |
last post by:
Hi all,
I hope someone can help me out. I need to return the best available seats subject to the constraint that the seats are side by side (or return X consecutive records from a table column...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
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...
|
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...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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,...
| |