try putting a trim around qGetUser.User_Type in the cfif, it is likely
bringing a space(s) in your result


-----Original Message-----
From: Bruce Sorge [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 14, 2001 8:43 AM
To: CF-Talk
Subject: CFIF Issue


OK. I have the following code:

<!--- Get the usertype from the database so that we can fire off the 
correct set of queries --->
<cfquery datasource="#Application.DSN#" name="qGetUser">
    Select User_Type
    From Users
    Where Auth_User = '#CGI.Auth_User#'
   </cfquery>

<!--- Output the variable so that I can be sure what I am seeing. 
Comment this out on the Production Server --->
   <cfoutput>#qGetUser.User_Type#</cfoutput>

<!--- If the User_Type is User, then fire off the query that selects 
ONLY the lab tests that the user is allowed to edit--->

   <CFIF qGetUser.User_Type IS "User">
    <cfquery datasource="#Application.DSN#" name="qGetTests">
        SELECT bcon.AutoNumber, bcon.CERNER_Mnemonic, bcon.CERNER_Code
        FROM (Sections INNER JOIN UserSection ON Sections.Section_ID = 
UserSection.Section_ID) INNER JOIN bcon ON Sections.Section_ID = 
bcon.Section_ID
        WHERE (((UserSection.Auth_User)='#CGI.Auth_User#'))
        AND Cerner_Mnemonic <> ''
        Order By Cerner_Mnemonic
   </cfquery>

<!--- If the User_Type is Admin, fire off the query to get all of the 
labs --->

<cfelseif qGetUser.User_Type IS "Admin">
<cfquery datasource="#Application.DSN#" name="qGetTests">
    SELECT bcon.AutoNumber, bcon.CERNER_Mnemonic, bcon.CERNER_Code
    FROM BCON
    WHERE Cerner_Mnemonic <> ''
    Order By Cerner_Mnemonic
   </cfquery>
</cfif>

When I run this, the outputted User Type is User (I see it on the screen 
from the <CFOUTPUT> I have above). So I know that the User Type is User. 
However, the CFIF statements are not picking this up. The weird thing is 
that I have a similar application in production that uses the same 
logic, and it works fine. I am baffled!

Thanks,
Bruce


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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