Bad Error Message
May 23, 2005
I recently did this:
<cfoutput query="#queryName#"> ... </cfoutput>
Can you spot the error?
I think that is probably a very common mistake - here's the error message you get in ColdFusion MX 6.1:
Complex object types cannot be converted to simple values. The expression has requested a variable or an intermediate expression result as a simple value, however, the result cannot be converted to a simple value. Simple values are strings, numbers, boolean values, and date/time values. Queries, arrays, and COM objects are examples of complex values.
The most likely cause of the error is that you are trying to use a complex value as a simple one. For example, you might be trying to use a query variable in a CFIF tag. This was possible in ColdFusion 2.0 but creates an error in later versions.
The error occurred on line 14.
I realize that this is a generic error message, but in this case - for what is probably a very common thing to do - why not something like You passed in a query object, when we expected the name of a query. You may need to remove the pound signs..
Trackback Address: 366/25247FC406B073C1778F7F0B96AF2B34
Or here is a crazy idea... instead of throwing an error - just work with the passed in query. ;)
Yeah Ray I thought about that too, but that would create code that didn't work on previous versions of CF... not sure if that is an issue for many people?
Well, the same could be said for cfdocument. It won't work in CF5 either. ;)
Yes I understand that, but if your writing software that has to work on multiple versions of CF it can make it easy to introduce bugs. Again, I'm not sure if that is an issue for many people.
I think my biggest gripe is that, when doing lots of SQL work, I may do this: <cfif a = b>....</cfif>
The error at least tells you that you need "IS" instead of "=", but if it can figure out exactly what you did wrong, why not just do what it seems to know you meant?!
Laziness. They write one generic error message to cover 20 cases, rather than specific messages for each case.
Don't get my wrong, it's not just a Macromedia thing, lots of software companies are guilty of this.
Iam talking with w.r.t coldfusion MX.
If ur getting an error "ByteArray Object cannot be converted to String" Follow this procedure. Here #id# is a ByteArray Object
<cfset aAbcArray = ArrayNew(1)> <cfset aAbcArray = #id#> <cfset ArrayAppend(aAbcArray, "")> <cfset one = aAbcArray> <cfset one = #BinaryEncode(#id#,'Hex')#> <cfoutput>#one<cfoutput>
Remember ByteArray Object is a complex data type and cannot be converted to simple data type. If u find this problem then use the array value directly instead of #one# value. Like this 'aAbcArray.value'
@Raymond.. yes!!! and then we finally can get function calls within the query attribute.. like:
<cfset qry = createObject("component"...
That would be very nice indeed!!
P.S. Pete... could you add xmlFormat or HTMLEditFormat to your RSS feed.. that way I can view the CF code in my RSS reader (Feeddemon in my case);-) txns!! Oh wait.. you have that.. hmmm strange Feeddemon doesn't show me the code :-(
Tjarko - that is a good point, I didn't think of that...
I'm not sure why you can't get view the code in your RSS reader... I am pretty sure its all valid xml, I'll look into it.
Using a Query to get an image from a ms access database.
I put this into a variable. But when i try to display the variable, i get the error message: "ByteArray Object cannot be converted to String"
Query name = Get_Product
Variable = #Get_Product.Photo# I also tried it with Quotes but then that just gave me the box with the X thru it.
Any clue? Anyone?
Ricky, I ran into this same problem. In acces locate the image that you want in the field where you want it with a hyperlink...then change it to text, and then take out the string tags #'s. So now you just have the path in the datasheet view cell. I happened to be using dreamweaver. So I put the cursor in the ceell within the dynamic table of the dynamic page then clicked insert--> image-->clicked the radio button for data source on the dialog box chose the content source I needed...waited a second for it to populate, then hit OK. I then put the entire site, went to the browser brought up my site, hit refresh and the image appeared. If you are working with a master/detail set then you would do the same for the detail page.
how about "cannot read your messages (bad data 1) what's with that?