Skip to main content
Participant
February 10, 2009
Question

cannont convert to boolean

  • February 10, 2009
  • 2 replies
  • 372 views
I have the following code below that I'm using to create an if statement from a list of agentsines. the user enters 22,23,75,13,42, etc as the 'Agents' variable and I want to translate it to
<cfset IfStatement = "bkagtid EQ '22' OR bkagtid EQ '23' OR bkagtid EQ '75' OR bkagtid EQ '13' OR bkagtid EQ '42'">
and then use something like <cfif #ifstatement#>
when I do that I get an error that says
"cannot convert the value "bkagtid EQ '22' OR bkagtid EQ '23' OR bkagtid EQ '75' OR bkagtid EQ '13' OR bkagtid EQ '42'" to a boolean "

Any ideas on if this is possible?

Thanks
    This topic has been closed for replies.

    2 replies

    Inspiring
    February 10, 2009
    One cannot "build" CFML source code at run time, which is what you're
    trying to do here. CFML is compiled (to bytecode, but still compiled)
    before it's executed, so any CFML has to be syntactically complete at
    *compile time*. It's not the CFML that's executed, it's the bytecode.

    You need to revise your logic accordingly.

    --
    Adam
    Participant
    February 10, 2009
    Nevermind, I used the ListFind function and was able to get it to work using that.