This content has been marked as final. Show 6 replies
I have found that some cf functions don't handle functions within functions very well. I would try evaluating the the whole of the third argument first and then just putting the result into the function. At the very least it will help to see where the error is occurring.
Like all CF functions calls, CF parses each argument passed in to iif()
before iif() gets a chance to do its thing. All three arguments
(condition, value-to-return-if-true, value-to-return-if-false) need to be
valid at run time, even if one of the latter two arguments isn't ultimately
Did you read the docs for iif()?
I find two things wrong with the statement. First, the equality sign right after cfset is no good. Secondly, throwing it all into one statement makes your code difficult to debug and to maintain. I would do something like the following.
> I find two things wrong with the statement. First, the equality sign right
> after cfset is no good.
Why not? If one is not interested in the returned result of the operation,
why bother storing it in a variable?
With querySetCell() the object of the exeercise is to set the value in the
passed-in query, not to capture whether the operation was a success.
I can't say I have ever come across a situation in which querySetCell()
> <cfset isCellSet = QuerySetCell(ErrorQuery, m, netNoOfHeads)>
What is isCellSet subsqeuently used for? Not necessarily in this code, but
say for example some of your code which would use querySetCell().
I will agree that the original code is a bit difficult to follow. I'd just
use an equivalent <cfif> statement rather than an iif() function call,
rather thab horse around setting all those extra variables as per your
example, though. They just seem like clutter rather than adding any
clarify. But, you know, each to their own.
OK. Thanks for all the feedback. The '=' sign right after the cfset was a typo but i typically never set QuerySetCell to a variable as i never need the result. I guess the problem is that the first condition is only viable if the condition is true. I have it set up in a cfif/else structure but i thought if i could make it a one line using a condition?s1:s2 type structure it would be more efficient but i guess it doesn't work like that. I did read the docs but didn't understand that part until i reread it.
>> I find two things wrong with the statement. First,
>> the equality sign right after cfset is no good.
> Why not?
Because it is a mistake.
>What is isCellSet subsqeuently used for? Not
> necessarily in this code, but say for example some of
> your code which would use querySetCell().
It is a boolean that tells you whether or not the data was successfully set in the query cell. It will be false if, for whatever reason, the operation failed to set the data in the query. It might be critical to your application to know that. However, I agree that using <cfset true> or <cfset isCellSet = true> is, to a certain extent, a matter of style.