Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Cold Fusion lang question

Posted on 2013-06-11
2
Medium Priority
?
253 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
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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month12 days, 12 hours left to enroll

972 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