Skip to main content
Known Participant
Oct 21, 2019 9:29 PM UTC
Question

Stupid CFIF Issue

I have an issue with a CFIF statement that is driving me nuts. I'm sure it will end up being something stupid, but for now I need some help. 

 

Here is the code:

<cfoutput query="get_procedures">
<tr>
<td>#procedureid#</td>
<td><a href='new-procedure-page-1/?id=#procedureid#'>#procedurename#</a></td>
<td align="center">#proceduretypename#</td>
<td align="center">#name#</td>
<td align="center"></td>
<td align="center">#statusname#</td>
<td>
<img alt="" src="/#application.environment#/assets/Image/copy_24px.png" style="cursor:pointer;" title="Copy Procedure" />
<img alt="" src="/#application.environment#/assets/Image/renew_24px.png" style="cursor:pointer;" title="Renew Procedure" />
<cfif #statusname# neq "Archived">
#statusname#<a href="archive-procedure/?id=#procedureid#"><img alt="" src="/#application.environment#/assets/Image/archive_24px.png" style="cursor:pointer;" title="Archive Procedure" /></a>
</cfif>
</td>
</tr>
</cfoutput>

 

The issue si with the CFIF statement near the end of the code. If the statusname does not equal "Archived", then it is supposed to display the Archive icon. If it does equal "Archived" then is should not display the icon. If you look at the screenshot, you'll see that the icon is displaying even when the statusname = Archived.  Any idea as to why this is not working?

    This topic is closed to new replies. Start a new post to keep the conversation going.

    4 replies

    WolfShade
    Legend
    Oct 22, 2019 12:55 PM UTC

    <cfif trim(lcase(get_procedures.statusname)) neq "archived"> should do it.

     

    I always scope my variables.  Queryname, form, url, variables, etc.  I also always trim and lcase them, unless they are uuids.

     

    V/r,

     

    ^ _ ^

    Translate
    dwright65Author
    Known Participant
    Oct 22, 2019 6:38 PM UTC

    This worked like a charm.

     

    Thanks

    Translate
    WolfShade
    Legend
    Oct 22, 2019 7:29 PM UTC

    Glad I could be of help.

     

    V/r,

     

    ^ _ ^

    Translate
    BKBK
    Community Expert
    Community Expert
    Oct 22, 2019 4:46 AM UTC

    I would use

    <cfif "#statusname#" neq "Archived">

    or

    <cfif get_procedures.statusname neq "Archived">

     

    or

     

     

    Translate