Since the condition in your queries is not always the same (ie coming from
the index of the loop) it might be safest to create some variables that you
can set and clear on each iteration of the loop, then before you use them in
your output, check the length...


cfparam a bunch of variables to use to capture output
start loop
run queries setting appropraite values for cfparams defined above
check vars
if len not 0 output, then reset
loop again...

Might that work?


Mike

-----Original Message-----
From: Jim Louis [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 02, 2003 9:24 AM
To: CF-Talk
Subject: RE: reseting querys values in a loop

Code

<cfloop index="recordid"
    From = "46"
    To = "1811"
    step =  "1">
<cfoutput>
#recordID#<br>
</cfoutput>
<cfset rmtotal=1>
<cfset EBRMTOTAL=1>
<cfquery Name="NameInfo" datasource="lifew05">
            select *
            From tblNam
            where Nam_ID=#recordid#
</cfquery>

<CFIF NameInfo.Nam_HOTROOMMATEFNAME1 IS NOT ''>
<CFQUERY DATASOURCE="DB" NAME="GetRoommate1">
    SELECT *
      FROM tblNam
     WHERE Nam_BadgeName = '#NameInfo.Nam_HOTROOMMATEFNAME1#' and
Nam_Lname = '#NameInfo.Nam_HOTROOMMATELNAME1#' and Nam_EmployeeCode =
'#NameInfo.Nam_HOTROOMMATETCODE1#'
</CFQUERY>

<CFIF GETROOMMATE1.RECORDCOUNT IS 0>

<CFELSE>

<CFQUERY DATASOURCE="lifew05" NAME="GetRoommate1a">
    SELECT *
      FROM tblHotel
     WHERE HotUser_ID = #Getroommate1.Nam_ID#
</CFQUERY>
<CFSET RMTOTAL= #RMTOTAL# + #GETROOMMATE1.RECORDCOUNT#>

</CFIF>
</CFIF>

The other seven are similar to the  one above.

--
Jim Louis
Best Meetings, Inc.
Phone: 952-858-8875
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to