Kevin,

I'm actually surprised that CF doesn't throw an error with the statement.
Get rid of the "is 'TRUE'" portion:
if( Check_NT.RecordCount GT 0 ){

}

(You can shortcut this further to just "if( Check_NT.RecordCount ){"

Also, I don't notice any brackets around your IF statement, which means only
the first line after the statement would be ignored.

-Dan

-----Original Message-----
From: Kevin Gilchrist [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 22, 2001 12:10 PM
To: CF-Talk
Subject: Why doe my cfscript if statement fail?

Hi There,

I'm trying to find why this if condition keeps getting evaluated as true
when it shouldn't.  I've traced through the debugger to track the value of
the if condition and even though the record count condition comes up as 0
when I put a watch on it, it still executes.
I added a CFOUTPUT between the query and the <CFSCRIPT> and it always
returns a 0 on the page too.

<!--- Check if we're monitoring NT --->
<cfquery name="Check_NT" datasource="#dsn#" dbtype="#driver_type#">
        select distinct system_type from uv_system_all
        where system_type='NT'
</cfquery>

<cfoutput>#Check_NT.RecordCount#</cfoutput>

<!--- If we count one or more we add it to an array of structures --->
<CFSCRIPT>
        if (Check_NT.RecordCount gt 0 is "TRUE")
                session.device_view_list[#device_no#]=StructNew();
                StructInsert(session.device_view_list[#device_no#],
"monitored", "TRUE");
                StructInsert(session.device_view_list[#device_no#],
"description", "NT Servers");
                StructInsert(session.device_view_list[#device_no#],
"icon_filename", "../images/med_icons/icon_fileserver");
                device_no=device_no + 1;
                // Note, the icon filename is incomplete because the status
color and the .gif will be appended later
</CFSCRIPT>

Would appreciate any help as this is my first time putting my hand to
cfscript...

Thanks,
Kevin

Kevin Gilchrist,
Senior Consultant
RedSiren Technologies,
www.redsiren.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to