My idea would be to run the query twice. First run would have the order reversed so that you can check for changes.
As you loop through this first query build up a list of colours for each entry based on EQ or NEQ previous entry. Then run the query again with the correct order by. As you loop through you can refer to your list (in reverse order or course!) for the colour of each cell. If your query takes lots of DBMS resources this would be a bad idea. Also if the number of cells is very large a list may also be impractical and maybe an array would work better. HTH On Apr 6, 2005 9:41 PM, Alisa Thomson <[EMAIL PROTECTED]> wrote: > 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:201788 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=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

