Solved

Looping and checking the previous row for a value in a loop?

Posted on 2006-06-16
2
169 Views
Last Modified: 2013-12-24
Hi,

I am trying to work with this recordset and cant recall how to do this.  Each record has a date, but when looping over the records if the date in the currentRow is equal to the date in the previous row, then don't show a date.  This should be very easy to do.  I just cant recall the correct syntax for doing so.

I have a query that I am looping over and each record has a "date" so:

DATE          STATE
04/10/06     CA
04/10/06     OR
04/15/06     FL
04/18/06     WY


If you notice above, the date 04/10/06 appears twice.  I only want the date to appear once if it is the same so it should be like:

DATE          STATE
04/10/06     CA
                  OR
04/15/06     FL
04/18/06     WY

There must be a way to take the currentRow's date value and then look at the previous row and if its the same, make it blank.

-ws
0
Comment
Question by:Westside2004
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Accepted Solution

by:
73Spyder earned 175 total points
ID: 16923153
Easiest way would be to set a temp variable

<cfset variables.temp_value = "">
<cfoutput query="your_data">
     <cfif your_data.date NEQ variables.temp_value >
             display date here
     </cfif>
   // - Rest of data here


<cfset variables.temp_value = your_data.date>
</cfoutput>

This should displat the date the first time it appears in the recordset but skip other rows
0
 
LVL 1

Author Comment

by:Westside2004
ID: 16923536
Worked... thanks

-ws
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question