Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 997213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:59:49+00:00 2026-05-16T06:59:49+00:00

How would I create this statement in CF? <cfif (not isdefined(URL.room) or #URL.room# EQ

  • 0

How would I create this statement in CF?

<cfif (not isdefined("URL.room") or #URL.room# EQ "")
      and (not isdefined("URL.system" or #URL.system# EQ "")
      and (not isdefined("URL.date") or #URL.date# EQ "")>

Obviously the parentheses don’t work, but illustrate what I am trying to accomplish. What is the syntax for this?

EDIT:
Ok, I understand how to use EQ and all that. I posted this in a bit of a hurry. My question is about the parentheses. Is it syntactically correct to use them this way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:59:49+00:00Added an answer on May 16, 2026 at 6:59 am

    EDIT: Ok, I understand how to use EQ
    and all that. I posted this in a bit
    of a hurry. My question is about the
    parentheses. Is it syntactically
    correct to use them this way?

    Syntactically, yes. The code’s syntax is correct and will not throw syntax errors.

    However, it’s not necessarily the best way to do it. At the very least you should have linebreaks in there, to make it more readable, like so:

    <cfif (not isdefined("URL.room") or URL.room EQ "")
        and (not isdefined("URL.system" or URL.system EQ "")
        and (not isdefined("URL.date") or URL.date EQ "")
        >
    

    And I would be more inclined to write it like this:

    <cfif NOT
        (  ( isDefined('Url.Room')   AND Len(Url.Room)   )
        OR ( isDefined('Url.System') AND Len(Url.System) )
        OR ( isDefined('Url.Date')   AND Len(Url.Date)   )
        )>
    

    Because that’s much more readable, and makes it more obvious that each row is checking the same thing.

    That is assuming I was doing this in a single IF statement, anyway.

    If you start getting lots of conditions to check, you might want to consider doing something like this instead:

    <cfset FieldList = "Room,System,Date" />
    <cfset AllFieldsValid = true />
    <cfloop index="Field" list="#FieldList#">
        <cfif NOT ( StructKeyExists(Url,Field) AND Len(Url[Field]) )>
            <cfset AllFieldsValid = false />
            <cfbreak/>
        </cfif>
    </cfloop>
    
    <cfif AllFieldsValid>
    ...
    

    Which might look intimidating at first, but is much easier to maintain – you just add a new item to FieldList (and you may already have a variable which serves that purporse).

    Anyway, hopefully all this helps – let me know if any questions on it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it taboo to programatically create system restore points? I would be doing this
I want to use find_or_create_by, but this statement does NOT work. It does not
Using Zend_Form, how would I create form elements like this: <input type=text name=element[1] value=
I would like to create XML Schema for this chunk of xml, I would
hi i would like to create a custom calendar, this calendar will have custom
I'd like to create an application that would run on Google's appengine. However, this
I can't quite figure out why this Linq Statement isn't working as i would
I'm looking to find out what kind of 'create table' statement I would need
This is related the following question , but I thought I would create another
I normally would create a limited rights user and run the process under that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.