• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Stupid CFIF Issue

New Here ,
Oct 21, 2019 Oct 21, 2019

Copy link to clipboard

Copied

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?

Views

207

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 21, 2019 Oct 21, 2019

Copy link to clipboard

Copied

I would use

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

or

<cfif get_procedures.statusname neq "Archived">

 

or

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 22, 2019 Oct 22, 2019

Copy link to clipboard

Copied

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

 

^ _ ^

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 22, 2019 Oct 22, 2019

Copy link to clipboard

Copied

This worked like a charm.

 

Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 22, 2019 Oct 22, 2019

Copy link to clipboard

Copied

LATEST

Glad I could be of help.

 

V/r,

 

^ _ ^

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation