Hi,
I am outputting a query into a table. I am listing titles of workshops, and dates and times.

If there is more than one date/time for a workshop, I add a separate row for each date/time. I would like to have all the rows for each workshop be the same color. Since the number of rows for each workshop varies, is there a way for me to find out if the previous row is for the same workshop?

Thank you!

Recommended Answers

All 2 Replies

You could track the previous value yourself using a variable. Simply initialize it before your query loop starts. Inside the loop perform your comparison. Then update the variable with the current value the end of each loop.

<cfset previousWorkshop = "">
<cfoutput query="yourQuery">
   <cfif (some comparison with previousWorkshop here ...)>
       ... do stuff ...
   </cfif>

  <cfset previousWorkshop = currentWorkShop>
</cfoutput>

Alternately, you can access any valid query row using array notation #queryname["columnname"][ rownumber]#

Thank you, arrgh!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.