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?
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:
And I would be more inclined to write it like this:
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:
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.