Bad Error Message

coldfusion

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..



Related Entries

This entry was:

 Download FuseGuard WAF for ColdFusion

Trackbacks

Trackback Address: 366/25247FC406B073C1778F7F0B96AF2B34

Comments

On 05/23/2005 at 7:37:32 PM EDT Raymond Camden wrote:
1
Or here is a crazy idea... instead of throwing an error - just work with the passed in query. ;)

On 05/23/2005 at 7:50:52 PM EDT Pete Freitag wrote:
2
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?

On 05/23/2005 at 7:52:48 PM EDT Raymond Camden wrote:
3
Well, the same could be said for cfdocument. It won't work in CF5 either. ;)

On 05/23/2005 at 7:59:47 PM EDT Pete Freitag wrote:
4
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.

On 05/24/2005 at 9:16:37 AM EDT Will Belden wrote:
5
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?!

On 05/24/2005 at 12:07:25 PM EDT Anj wrote:
6
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.

On 05/27/2005 at 7:49:53 AM EDT Rauf Khan wrote:
7
Hi,

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[1] = #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'

Rauf

On 06/07/2005 at 11:30:13 AM EDT Tjarko wrote:
8
@Raymond.. yes!!! and then we finally can get function calls within the query attribute.. like:

<cfset qry = createObject("component"...

<cfoutput query="#qry.getContent()#">...

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 :-(

On 06/07/2005 at 4:19:22 PM EDT Pete Freitag wrote:
9
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.

-pete

On 12/03/2005 at 11:06:42 AM EST Ricky wrote:
10
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?

On 03/02/2006 at 10:22:11 AM EST Randy wrote:
11
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.

On 03/14/2006 at 10:39:29 AM EST alice wrote:
12
how about "cannot read your messages (bad data 1) what's with that?

Post a Comment




  



Spell Checker by Foundeo

Recent Entries



foundeo


did you hack my cf?