Solved

Cold Fusion lang question

Posted on 2013-06-11
2
237 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 300 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 200 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
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 …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

932 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now