cannot convert the value x to a boolean
Hi, I have a loop that searches for keywords, although when I search for 'string' values get an error: cannot convert the value x to a boolean. If I remove the statement: u.isactive = cfqueryparam value=#IIF(arguments.query, 1, 0)# then only finds 'string' keywords with no errors. If I run the code below it only finds 'boolean' keywords and when I enter a 'string' value produces the error above. This is a snippet of my code: cfloop list=#arguments.query# index=keyword delimiters= ,; WHERE u.email LIKE cfqueryparam value=%#arguments.query#% OR r.rolename LIKE cfqueryparam value=%#arguments.query#% OR u.isactive = cfqueryparam value=#IIF(arguments.query, 1, 0)# /cfloop Thanks Tom ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350881 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: cannot convert the value x to a boolean
I see two issues. First, you are trying arguments.query like a list, but you don't use the value. Ie, you said, loop over it and put the value in keyword, but your code never uses it. Secondly - you seem to be wanting to treat the keywords as booleans. That's not going to work. On Mon, Apr 30, 2012 at 6:27 AM, Tom Small t...@re-base.net wrote: Hi, I have a loop that searches for keywords, although when I search for 'string' values get an error: cannot convert the value x to a boolean. If I remove the statement: u.isactive = cfqueryparam value=#IIF(arguments.query, 1, 0)# then only finds 'string' keywords with no errors. If I run the code below it only finds 'boolean' keywords and when I enter a 'string' value produces the error above. This is a snippet of my code: cfloop list=#arguments.query# index=keyword delimiters= ,; WHERE u.email LIKE cfqueryparam value=%#arguments.query#% OR r.rolename LIKE cfqueryparam value=%#arguments.query#% OR u.isactive = cfqueryparam value=#IIF(arguments.query, 1, 0)# /cfloop Thanks Tom ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350882 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: cannot convert the value x to a boolean
I see two issues. First, you are trying arguments.query like a list, but you don't use the value. Ie, you said, loop over it and put the value in keyword, but your code never uses it. Secondly - you seem to be wanting to treat the keywords as booleans. That's not going to work. Hi Ray thanks for the reply. Can you tell me how I should treat the boolean, and do I need to place the boolean within an cfif statement? Appreciate your advice. Tom ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350883 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: cannot convert the value x to a boolean
You can check to see if a value can be treated as a boolean by checking isBoolean(). On Mon, Apr 30, 2012 at 6:46 AM, Tom Small t...@re-base.net wrote: I see two issues. First, you are trying arguments.query like a list, but you don't use the value. Ie, you said, loop over it and put the value in keyword, but your code never uses it. Secondly - you seem to be wanting to treat the keywords as booleans. That's not going to work. Hi Ray thanks for the reply. Can you tell me how I should treat the boolean, and do I need to place the boolean within an cfif statement? Appreciate your advice. Tom ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350884 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: cannot convert the value x to a boolean
You can check to see if a value can be treated as a boolean by checking isBoolean(). Hi Ray thanks ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350885 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm