Solved

Cold Fusion lang question

Posted on 2013-06-11
2
243 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 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

623 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