Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Search button in Oracle Forms

Re: Search button in Oracle Forms

From: ejunkmail_at_planet.nl <(ejunkmail_at_planet.nl)>
Date: 04 Jan 2006 13:12:58 GMT
Message-ID: <43bbc9da$0$1812$ba620dc5@nova.planet.nl>


<QUOTE>
Hi
I have form with one data block. It shows all records from database table. I want to let user filter these data. Does anyone know how to do that? I was searching in google and news groups but I hadn't found any tips or tutorials.
Thanks
</QUOTE>

Normally, this functionality is indeed avalaible through the buttons in the buttonsbar and some function keys like F7 (= enter query). From real life I must admit that i have seen situations in which this is not a working option. So we had to use a button. This is the way is should work.
The filter in which the filtering conditons should be types by the user should be 'dummy' fields, that is not database fields. Then in the WHEN-BUTTON-PRESSED trigger, you can get the values of that field(s) and then create a default where clause for that datablock using SET_BLOCK_PROPERTY (reasd the help file for detaild explanation). This is indeed a normal where like in SQL. For example the where clause could be : 'where kol1=1 and kol2 between 6 and 8'. When u have set the default where clause using SET_BLOCK_PROPERTY, you can issue the execute_quoery command. So the code in the WHEN-BUTTON-PRESSED trigger should be something like this

   lv_def_where varchar2(32676);
   lv_dum_val varchar2(2000);
begin

   lv_dum_val := :blockname.field_name;
   lv_def_where := 'KOL1='||''''||lv_dum_val||'''';    SET_BLOCK_PROPERTY(DATABLOCK,DEFAULT_WHERE LV_DEF_WHERE);    go_item('query_item');
   execute_query;
end;

-- 
----------------------------------------------
Posted with NewsLeecher v3.0 Final

* Binary Usenet Leeching Made Easy
* http://www.newsleecher.com/?usenet
----------------------------------------------
Received on Wed Jan 04 2006 - 07:12:58 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US