Does cf's "query of query" support sql "union"?  If so you could probably use that to create a new query from the old one that had the new record sorted to the correct position (assuming you could define the sort order using the fields in the query).  Then put the new query into your session variable.  This is pretty much the same as copying the query by hand but hopefuly it could be done with less code (but probably not faster in execution time, if that matters to you).

________________________________

From: Burns, John D [mailto:[EMAIL PROTECTED]
Sent: Fri 7/2/2004 2:37 PM
To: CF-Talk
Subject: RE: Insert row into middle of existing query

You'd probably have to copy the query object to another object and move
all of the rows that are after the row you're wanting to add down 1
space and insert the row you want above.  I don't think there's any
automatic way to do it.  You'd basically be looping over the whole
query.

John

-----Original Message-----
From: Mike Chabot [mailto:[EMAIL PROTECTED]
Sent: Friday, July 02, 2004 2:30 PM
To: CF-Talk
Subject: Insert row into middle of existing query

After a database insert, I would like to update the cached query
(session
scope) instead of going back to the database and repeating the query.
The main problem is that the order of the query matters since I am using
the group attribute of cfoutput. The query needs to be ordered by date.
The QueryAddRow function can add a row to the end of the query, which
means I need to take the extra step of reording the query by date. When
I try to reorder the query using a QoQ with an order by clause, I get
the error:

"Error casting an object of type to an incompatible type. This usually
indicates a programming error in Java, although it could also mean you
have tried to use a foreign object in a different way than it was
designed. "

<cfquery name="this.active.qDailyData" dbtype="query"> SELECT * FROM
this.active.qDailyData ORDER BY ActivityDate </cfquery>

So, is there any way to efficiently add a new row to a specific point in
the middle of an existing query?

Thank you,
Mike Chabot
________________________________
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to