Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Cold Fusion lang question

Posted on 2013-06-11
2
Medium Priority
?
250 Views
Last Modified: 2013-06-18
Hi,
I have this statement which checks to see if anything exists in the  url field.

<cfif len(associate.url)>
## Field has a value in it
</cfif>

How would I check to see if the field IS NOT populated
This:
<cfif ! len(associate.url)>

or
<cfif not len(assicate.url)>

Neither? Both? Something else?
Thanks!
N
0
Comment
Question by:nachtmsk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 39

Accepted Solution

by:
gdemaria earned 1200 total points
ID: 39238092
<cfif not len(assicate.url)>  -- field has no size

or you can just do..

<cfif  len(assicate.url) eq 0>  --- field is empty


I prefer the above, but you can also test to see if its equal to an empty string

<cfif  assicate.url  is "">
0
 
LVL 52

Assisted Solution

by:_agx_
_agx_ earned 800 total points
ID: 39238226
> Neither? Both? Something else?

Any of the above, incuding gdemaria's example.  They should all do the same thing. So it's a matter of personal preference.

One other thing that may or may not apply here ... if you want to ignore extra white space, like "(space)" or "(multiple spaces)" , trim() the values first.  ie

        <cfif !len(trim(associate.url))>
0

Featured Post

Linux Academy Android App Now Supports Chromecast

We have some fantastic news for our Android fans. We’re so excited to announce that the Linux Academy Android app is now available with Chromecast support. That’s right – simply download the latest update of the Linux Academy App and start casting your favorite course videos!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question