How about something like this?
function setChangeStyle (recordset,column,row) {
result = 'defaultClass';
if (row LT (recordset.recordcount - 1) AND recordset[column][row+1]
NEQ recordset[column][row]) {
result = 'highlightClass';
}
return result;
}
In code, you would just have <td
class="#setChangeStyle(query,'ratepct',query.currentrow)#">
May not work, just a quick first thought...
- Calvin
-----Original Message-----
From: Alisa Thomson [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 06, 2005 4:41 PM
To: CF-Talk
Subject: Best way to do this? Data structure?
I know this is a simple problem, but I must have too many projects on my
plate because I haven't been able to get this one. I have a query that
returns data like:
Description OrderDate RatePct
1 Week 4/01/05 3.5
1 Week 3/01/05 3.6
1 Week 2/01/05 3.6
2 Week 4/01/05 2.5
2 Week 3/01/05 2.5
2 Week 2/01/05 2.0
The primary key is the Description/Order Date and it is supposed to be in
descending order. The data is then displayed to the user in a table
based on description for the row and the OrderDate for the column, like:
4/01/05 3/01/05 2/01/05
1 Week 3.5 3.6 3.6
2 Week 2.5 2.5 2.0
A simple CFOUTPUT with a GROUP attribute on Description works fine to
display this table. However, now I need to color-code the ratepct if the
value has changed. Since the values are displayed in descending order, I
cannot do it in the CFOUTPUT loop since I won't know if the data changed
until the next time through the loop. So, in the above example, the 3.5
should be highlighted in row 1 as a data change since the previous value was
3.6 and the 2.5 in the 3/01/05 column should be highlighted in the previous
value was 2.0. My initial thought was to have a data structure that held
the contents of the query that I could loop through prior to display and set
a new key/value pair for color. I have experimented with various
combinations of structs and arrays and haven't found the best way to do
this. Any ideas?? Thanks in advance.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:201787
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54