well, we want to add a column called 'selected' using addQueryColumn.

the best way to do this (would probably be faster too) would be to go

<cfquery name="session.myResults" datasource="#request.ds#">
select theTable.*, 1 as selected
from theTable
</cfquery>

I will probably end up doing this, just wanted to figure out what was going
on.

thanks,
simon

-----Original Message-----
From: Timothy Heald [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 27, 2002 10:12 AM
To: CF-Talk
Subject: RE: sessionquery.recordcount


The only time I have gotten a record count higher than I thought it should
be was when I was using aggregate functions. So I would get 1, even if there
was really nothing returned (because the result was a 0).

Aside from that, what are you doing that requires this? Maybe we could
figure out a better way of doing it?

Tim

-----Original Message-----
From: Simon Stanlake [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 27, 2002 1:04 PM
To: CF-Talk
Subject: sessionquery.recordcount


hi,
we have the following code...

        <cfquery name="session.myResults" datasource="#request.ds#">
        select  * 
        from    theTable
        </cfquery>
        
<!--- create an array of 1's to use in queryAddColumn --->
        <cfset defaultValueArray = ArrayNew(1)>
        <cfloop index="i" from="1" to="#session.myResults.recordCount#">
                <cfset defaultValueArray[i] = 1>
        </cfloop>

occasionally, we exit this piece of code and the length of the array is
different from the length of the query.  ie: 

        arraylen(defaultValueArray) != session.myResults.recordCount.

It seems to me that this should never happen.

I've changed the name of the table and the session variable, but otherwise
the code is a cut-and-paste.  I realize there are a bunch of different ways
to do this, but I want to know what causes this behaviour.  Has anyone else
seen something similar?  recordcount not always returning the right value?
cfloop bailing out early? funniness when storing queries in the session
scope?

thanks,
simon


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

Reply via email to