Re: Forms 4.5/Query hits before executing query.

From: Lee Mayhew <lmayhew_at_ionet.net>
Date: 1995/05/09
Message-ID: <3ookip$20i_at_ionews.ionet.net>#1/1


In article <tcoxD8BsBx.4GF_at_netcom.com>, tcox_at_netcom.com says...
>
>In article <3oe1nb$5lm_at_ionews.ionet.net>, Lee Mayhew <lmayhew_at_ionet.net>
 wrote:
>
>>I am developing a form that needs to count the number of records that
>>will be queried before it does the query and display it after the query
>>is finished, so I can return a message like....
 

>>1 of 22 owners retrieved.
 

>>I realize I can get this number by doing a:
 

>>hits := GET_BLOCK_PROPERY( block, QUERY_HITS );
 

>>but I can't figure out where to place this in my form to get the
>>correct number of hits. If I place it before the execute query, hits=0,
>>after the query, hits=1.
 

>>Any ideas or suggestions? Thanks in advance,
>
> Try doing it as the last statement in your block's PRE-QUERY
> trigger. ;-)
>
> (That's the same place you'd populate fields with values
> that you wanted to include in the query criteria. For
> example, if you have a pre-query trigger that sets field
> FOO to have value BAR, then you end up with the text
> WHERE foo = 'BAR' as part of the query.)
>
> I have not tested the counting of query hits, however.
>
> -Tom
>--
>Thomas B. Cox tcox_at_netcom.com
>Author of _Oracle Workgroup Server Handbook_, ISBN 0-07-881186-4
> See: http://www.oracle.com/info/magazine/orapress.html

Thanks for the suggestions. I couldn't ever get QUERY_HITS option to work with the GET_BLOCK_PROPERTY, but the COUNT_QUERY built-in seemed to work.

So what I did was write a procedure that extracts the number of hits from message text that is produced when using COUNT_QUERY or the count query key. I call this procedure before I execute my query and call another trigger which displays the text on the message line like:

1 of 30 owners

I had to turn the message level up to 25 so it wouldn't display, then extract the number from the text. A bit clumsy, but it works. Received on Tue May 09 1995 - 00:00:00 CEST

Original text of this message