Skip to main content
Inspiring
June 23, 2008
Answered

cannot convert the value "lower" to a boolean

  • June 23, 2008
  • 2 replies
  • 1170 views
I am trying to work out why this example gives me an error, it is meant to demonstrate the ability to return a data type other than a Boolean from a UDF but doesn´t seem to work. Why is that? I'm using cfmx7 which shouldn´t matter as udfs are cf5+ Thanks for any replies
This topic has been closed for replies.
Correct answer Newsgroup_User
Hydrowizard wrote:
> Thanks for the reply Phil, sorry I forgot to put that the error message is
> "cannot convert the value "lower" to a boolean". The return false part came in
> the code- I got rid of it now, I did think that it was always necessary though
> thanks for pointing that out.
>

Have your resolved your error?

If not, or for others it is in your first if clause:
<cfif not isUpperOrLowerCase("a")>

You are not comparing the function to anything so CF is trying to
convert the returned value 'lower' in this case to either true or false,
i.e. a boolean value, and failing. So it is telling you that it can not
convert 'lower' into a boolean value.

Now this would give it no problem.

<cfif not isUpperOrLowerCase("a") EQ 'lower'>

But then I am not sure what that is really testing.

2 replies

Inspiring
June 24, 2008
it is a sitepoint tutorial thanks for all the help
Participating Frequently
June 23, 2008
Why do you have a return false following your if .. return "upper" .. else .. return "lower"? And, you might want to post the particular error that you are getting in the future.

Phil
Inspiring
June 23, 2008
Thanks for the reply Phil, sorry I forgot to put that the error message is "cannot convert the value "lower" to a boolean" in the message body! The return false part came in the code direct from the tutorial I got rid of it now- so does anyone know why this error happens?