I see now that I had misread Karl's reference to Verity. Sorry everyone. So
you meant for CFQUERY to return not just how many records were found but how
many records were in the database that was searched. Hmm, no, that's not
something CF provides, and it's probably not really right to expect that
it's something CF should.

In the case of CFSEARCH, Verity can and does provide an easy number for
CFSEARCH to lookup for that RecordsSearched value, but if you think about it
it's because a) a verity index isn't typically updated all that often and b)
CF uses an API call (under the covers) to get that number that Verity
provides.

But for a database, it's a more dicey proposition. For one, the interface
between CF and a database is SQL (ok, under the covers there is an API call
between CF and DBMS or database drivers). If the drivers returned such a
record count, then CF could have access to it (though the CFQUERY would have
to be changed by Macromedia to expose that returned value as a CF variable).

So Gordon's proposal of a SELECT count(*) is the closest you'll come. One
may argue "why doesn't CF go ahead and do that for us and return a
recordssearched value?" Well, even that simple SQL statement does take time
to do (some DBMS's do it faster than others depending on their approach to
finding the answer). I don't know that all CF users would want that extra
I/O to take place if they didn't need the info. In that case, leaving it to
you to do yourself seems the more efficient choice.

Then, too, consider that if you're doing a search on a joined pair of
tables, which number would you want to be reflected in such a
"recordssearched" variable? The number in one or the other table? The sum?
The highest of the two? And what if there were more tables joined? Would it
instead be better to show the number of records that were joined
successfully?

These are all reasons why I don't think you'd ever see such a
"recordssearched" number from a CFQUERY.

/charlie

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Karl Zarudny
Sent: Wednesday, February 27, 2002 3:06 PM
To: [EMAIL PROTECTED]
Subject: Re: [CFTALKTor] Number of records searched


Thanks everybody. Gordon you hit the nail bang on, as far as what I was
trying to do. Too bad this is the only way to do it.... Would've thought
that CF being the elegant and efficient language it is, there'd be some way
to pull it out without having to perform the main query and then a
subsequent query to get the total records searched. Guess it's not a highly
demanded or required option.

Thanks again everybody!

> From: "Lipp, Gord" <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> Date: Wed, 27 Feb 2002 14:33:02 -0500
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> Subject: RE: [CFTALKTor] Number of records searched
>
> Hi Karl
>
> I don't think CFquery has anything comparible to recordssearched in
Verity.
> The only thing I can think of is doing
>
> <CFQUERY name="name" datasource="datasource">
> SELECT  Count(*) AS allRecords
> FROM    tablename
> </CFQUERY>
>
> Regards
>
> Gordon Lipp
>
> Systems Technician
> Guelph Public Library
> http://www.library.guelph.on.ca
>
>
>
>> -----Original Message-----
>> From: Karl Zarudny [mailto:[EMAIL PROTECTED]]
>> Sent: February 27, 2002 1:55 PM
>> To: CFUG
>> Subject: [CFTALKTor] Number of records searched
>>
>>
>> Hi All.
>>
>> How does one get the total number of records searched from a query? I
>> thought it was simply #queryname.recordssearched# but that
>> kicks back an
>> "error resolving param" message. Odd, since I seem to remember using
>> recordssearched once before but perhaps it worked that time
>> because I was
>> using it with a verity?....
>>
>> Thanks,
>> Karl
>>
>> -
>> You are subscribed to the CFUGToronto CFTALK ListSRV.
>> This message has been posted by: Karl Zarudny
>> <[EMAIL PROTECTED]>
>> To Unsubscribe, Please Visit and Login to http://www.CFUGToronto.org/
>> Manager: Kevin Towes ([EMAIL PROTECTED])
>> http://www.CFUGToronto.org/
>> This System has been donated by Infopreneur, Inc.
>> (http://www.infopreneur.net)
>>
> -
> You are subscribed to the CFUGToronto CFTALK ListSRV.
> This message has been posted by: "Lipp, Gord" <[EMAIL PROTECTED]>
> To Unsubscribe, Please Visit and Login to http://www.CFUGToronto.org/
> Manager: Kevin Towes ([EMAIL PROTECTED])
http://www.CFUGToronto.org/
> This System has been donated by Infopreneur, Inc.
> (http://www.infopreneur.net)

-
You are subscribed to the CFUGToronto CFTALK ListSRV.
This message has been posted by: Karl Zarudny <[EMAIL PROTECTED]>
To Unsubscribe, Please Visit and Login to http://www.CFUGToronto.org/
Manager: Kevin Towes ([EMAIL PROTECTED]) http://www.CFUGToronto.org/
This System has been donated by Infopreneur, Inc.
(http://www.infopreneur.net)

-
You are subscribed to the CFUGToronto CFTALK ListSRV.
This message has been posted by: "charles arehart" <[EMAIL PROTECTED]>
To Unsubscribe, Please Visit and Login to http://www.CFUGToronto.org/
Manager: Kevin Towes ([EMAIL PROTECTED]) http://www.CFUGToronto.org/
This System has been donated by Infopreneur, Inc.
(http://www.infopreneur.net)

Reply via email to