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

cfif and like

Explorer ,
Sep 19, 2008 Sep 19, 2008
I have a data collection that uses verity, I want to eliminate any results that contain the word footer in them. This is my code< i am overlooking something and I feel it is due to lack of sleep. Any thoughts? thanks
4.9K
Translate
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
Participant ,
Sep 19, 2008 Sep 19, 2008
Try changing this
<cfif #key# is not "">
and #key# is LIKE '%footer%'

to this

<cfif #key# NEQ "" AND #key# LIKE '%footer%'>
Translate
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
Explorer ,
Sep 19, 2008 Sep 19, 2008
Iget the following error

Invalid CFML construct found on line 34 at column 30.
ColdFusion was looking at the following text:

LIKE

The CFML compiler was processing:

* a cfif tag beginning on line 34, column 2.
Translate
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 ,
Sep 19, 2008 Sep 19, 2008
"like" is an sql keyword. The equivalent cf function is contains. Usage is described in the cfml reference manual and livedocs.
Translate
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 ,
Sep 19, 2008 Sep 19, 2008
On Fri, 19 Sep 2008 18:49:11 +0000 (UTC), brianism wrote:

> Try changing this
> <cfif #key# is not "">
> and #key# is LIKE '%footer%'
>
> to this
>
> <cfif #key# NEQ "" AND #key# is LIKE '%footer%'>

Can you please talk us through why you made this post / suggestion?

--
Adam
Translate
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
Participant ,
Sep 22, 2008 Sep 22, 2008
quote:

Originally posted by: Newsgroup User
On Fri, 19 Sep 2008 18:49:11 +0000 (UTC), brianism wrote:

> Try changing this
> <cfif #key# is not "">
> and #key# is LIKE '%footer%'
>
> to this
>
> <cfif #key# NEQ "" AND #key# is LIKE '%footer%'>

Can you please talk us through why you made this post / suggestion?

--
Adam



That would be because I could not remember if it should have been LIKE or CONTAIN. This coding stuff turns my mind into mush sometimes.
Translate
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 ,
Sep 22, 2008 Sep 22, 2008
LATEST
> That would be because I could not remember if it should have been LIKE or
> CONTAIN. This coding stuff turns my mind into mush sometimes.

Heh. At least you're honest. ;-)

--
Adam
Translate
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
Explorer ,
Sep 19, 2008 Sep 19, 2008
Here is the syntax...

<cfif key contains 'footer'>

<cfelseif len(foundResults.title) EQ 0>
<a href="interior.cfm?Cid=#key#">- Result - </a>
<cfelse>
<a href="#foundResults.URL#" target="_blank"> #foundResults.title#</a>
</cfif>



You don't need to check if key is not "" because it will not contain footer if it's empty.

You also don't need the # signs inside the CFIF


Translate
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