Macromedia MX related news and discussion
ColdFusion CFMX Query of Query Bug December 17, 2003

I found a bug in CFMX 6.1 this afternoon.

Apparently, when doing a Query of Query against a query created using the QueryNew() function, CFMX guesses what the datatype is for each column based on the data in the first row.

So if your Query of Queries sees an integer in the first column of the first row, and then sees a string in the first column of the second row, CFMX will throw an error that says it cannot convert the datatype to another datatype.

A quick work around is to add strings to the first row when using QueryNew(), then handling it later, but that really sucks.

Macromedia really needs to get on the ball with this one, because I use QueryNew() quite often, and I'm know I'm not alone.

Posted by Michael Buffington at 05:18 PM in ColdFusion | Permalink

TrackBack URL for this entry:

Listed below are links to weblogs that reference CFMX Query of Query Bug:

Dennis Spaag:

I just ran into that exact situation. It would be kinda nice to be able to tell CF what type you want each column to be rather than have it guess.

» by Dennis Spaag at Dec 17, 2003 8:33:55 PM
Steven Erat:

Have you tried using javacast() when adding data to an IMQ when using the QuerySetCell() function? javacast will set the type as you like when the data is added. Make sure that you cast all data for a given column to the same type.

I believe that ColdFusion assesses more than one row of data in a given column before trying to assign a type to it. I'll check on that.

» by Steven Erat at Dec 17, 2003 9:00:56 PM
Bryan F. Hogan:

Could not recreate the problem. Care to share your code that causes the error?

» by Bryan F. Hogan at Dec 18, 2003 7:16:39 AM
Randy Drisgill:

Yes I have run into this as well, javacast fixed my problem just fine.

» by Randy Drisgill at Dec 18, 2003 7:44:35 AM
tanpanza serge:

hi ,

i've the same problem with a QoQ.
CMFX change data type for QoQ.

» by tanpanza serge at Dec 18, 2003 12:19:25 PM

Have the same prob:

QoQ runs fine under 5.0, but crashes under 6.1:
Query Of Queries runtime error.
Unsupported type comparison.

Hope that there is a hotfix soon.

» by net.Det at Jan 21, 2004 11:30:53 AM

here's an example of how I coded the javaclass() function during the building of the initial query to work around the query of queries runtime error. just in case someone was wondering.

CFSET temp = QuerySetCell(SortReport, "fld_report_id", "#javacast('String',qTank_report.fld_report_id)#", #qESN.currentrow#)

I did this for every setcell.

» by darren at Feb 20, 2005 12:52:51 AM

javacast doesnt support dates though

» by Derek at Jan 12, 2006 6:48:16 AM
This work is licensed under a Creative Commons License.