Skip to main content
Known Participant
October 21, 2019
Question

Stupid CFIF Issue

  • October 21, 2019
  • 2 replies
  • 401 views

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 has been closed for replies.

    2 replies

    WolfShade
    Brainiac
    October 22, 2019

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

     

    ^ _ ^

    dwright65Author
    Known Participant
    October 22, 2019

    This worked like a charm.

     

    Thanks

    WolfShade
    Brainiac
    October 22, 2019

    Glad I could be of help.

     

    V/r,

     

    ^ _ ^

    BKBK
    Adobe Expert
    October 22, 2019

    I would use

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

    or

    <cfif get_procedures.statusname neq "Archived">

     

    or