Solved

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

Posted on 2006-06-16
2
172 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

Optimum High-Definition Video Viewing and Control

The ATEN VM0404HA 4x4 4K HDMI Matrix Switch supports 4K resolutions of UHD (3840 x 2160) and DCI (4096 x 2160) with refresh rates of 30 Hz (4:4:4) and 60 Hz (4:2:0). It is ideal for applications where the routing of 4K digital signals is required.

Question has a verified solution.

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

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
What You Need to Know when Searching for a Webhost Provider
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

717 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