Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2006-06-16
2
Medium Priority
?
178 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 700 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

Simplify Your Workload with One Tool

How do you combat today’s intelligent hacker while managing multiple domains and platforms? By simplifying your workload with one tool. With Lunarpages hosting through Plesk Onyx, you can:

Automate SSL generation and installation with two clicks
Experience total server control

Question has a verified solution.

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

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

618 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