If possible, try changing the name of the more "generic" fields in the
database.  I would also suggest scoping the variables to the query name
within the output.

One way to work around this problem would be to use logic similar to the
code you're already using for the release date display.  Set a local
variable at the end of the loop with the contents of news.notes and compare
that variable against the current value during display.  If they're equal,
don't display it, otherwise output.  While it's a clunky workaround and
should solve the problem, I would suggest eventually finding the source and
rewriting it properly.

-Justin Scott, Lead Developer
 Sceiron Internet Services, Inc.
 http://www.sceiron.com


----- Original Message -----
From: "Aimee Abbott" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, April 30, 2002 10:14 PM
Subject: RE: variable not being cleared in a loop?


> No, I can't order by title, I must order by date.  This is a list of news
> releases and public notices ordered by date, descending.
>
> However, even if I do order by title the same trouble happens.  This is
the
> page ordered by date, I did order by title after your message and the
> trouble still happens.
> http://www.pca.state.mn.us/news/data/index.cfm?NR=1
> Scroll down to April 1st, March 29th and March 28th.
>
> It happens.
>
> --aimee
>
> At 05:44 PM 4/30/2002 -0700, you wrote:
> >First of all your ORDER BY should probably start with title, since that
is
> >what you group by in your output.  If you don't you will likely output
the
> >same title more than once by accident.
> >
> >Other than that you should be fine.  A query row will NEVER inherit data
> >from another query row.
> >
> >+-----------------------------------------------+
> >Bryan Love
> >   Macromedia Certified Professional
> >   Internet Application Developer
> >   Database Analyst
> >Telecommunication Systems
> >[EMAIL PROTECTED]
> >+-----------------------------------------------+
> >
> >"...'If there must be trouble, let it be in my day, that my child may
have
> >peace'..."
> >         - Thomas Paine, The American Crisis
> >
> >
> >
> >-----Original Message-----
> >From: Aimee Abbott [mailto:[EMAIL PROTECTED]]
> >Sent: Tuesday, April 30, 2002 6:32 PM
> >To: CF-Talk
> >Subject: variable not being cleared in a loop?
> >
> >
> >I have something odd happening with a variable not being cleared.  The
> >trouble is with the "notes" field.  I query it and get the value from the
> >database.  The notes field is almost always filled in, however there are
a
> >few times where it is not.  If the notes field is blank, it will get
filled
> >in by the data from the last note field that was filled in.  How (and
why)
> >can this be???
> >
> >Here is my query:
> >
> ><CFQUERY name="news" datasource="newsData">
> >         select Notices.noticeID, Notices.title, Notices.reldate,
> >Notices.expiryDate, Notices.url, Notices.notes, Notices.release,
> >DT1.FullsizeIconAssoc, DT1.smallIconAssoc,supportDocs.title as
> >supportTitle, supportDocs.url as Surl, noticeType as NT
> >         from notices, docTypes DT1, supportDocs
> >         WHERE Notices.relDate <= '#todayis#'
> >         <cfif #noticeType# not equal 1>
> >                 AND Notices.relDate > '#minus60#'
> >         </cfif>
> >         AND ((Notices.expiryDate >= '#todayis#') or
((Notices.expiryDate) Is
> >Null))
> >         AND Notices.docTypeID = DT1.docTypeID
> >         and Notices.NoticeID = supportDocs.noticeID(+)
> >         <cfif #noticeType# equal "1" OR #noticeType# equal "2">
> >                 AND  noticeType = #noticeType#
> >         <cfelse>
> >                 AND Notices.whatsNew = 1
> >         </cfif>
> >         ORDER BY Notices.reldate DESC, Notices.NoticeID
> ></CFQUERY>
> >
> >
> >Then I have the output:
> >
> ><cfoutput query="news"  group="title">
> >         <!--- check to see if we have already printed the big date --->
> >         <cfif #lastDate# not equal #relDate#>
> >                 <tr><td valign=top bgcolor="c6d6bd" colspan="2"><font
> >size="+1"><b>#dateFormat(relDate, "mmmm dd, yyyy")#</b></font></td></tr>
> >
> >                 <cfset "lastDate"=#relDate#>
> >         </cfif>
> >         <tr>
> >                 <td valign="top"><img src="#FullsizeIconAssoc#"></td>
> >                 <!--- Turn back on for debugging --->
> >                 <!--- <td>#noticeID#</td><td>#relDate#</td> --->
> >                 <td>
> >                 <cfif #url# equal "http://"; and #release# not equal "">
> >                         <cfif (isdefined("WN")) and (#NT# equal 2)>News
> >Release: </cfif><a
> >href="newsRelease.cfm?NR=#NoticeID#&type=#NT#">#title# </a>
> >                         <!--- <br>#release# <br> --->
> >                 <cfelse>
> >                         <a href="#url#">#Title#</a>
> >                 </cfif><font color="White"
> >size="-2">NoticeID:#NoticeID#</font><br>
> >                         <cfif #NT# equal  "1">
> >                                 <font size="-1"><br>Open for public
comment
> >through
> >#DateFormat(expiryDate, "MMMM DD, YYYY")#</font>
> >                         </cfif>
> >                         <font size="-1">#notes#</font>
> >                         <!---                      ^------ HERE IS WHERE
THE
> >TROUBLE IS!!!!  --->
> >                         <br>
> >                 </td>
> >         </tr>
> >
> >         <cfif #supportTitle# not equal "">
> >                 <cfoutput>
> >                         <tr><td></td><td><img src="#smallIconAssoc#"> <a
> >href="#Surl#">#supportTitle#</a></td></tr>
> >                 </cfoutput>
> >         </cfif>
> >         <tr><td>&nbsp;</td></tr>
> ></cfoutput>
> >
> >
> >
> 
______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to