Home » Developer & Programmer » Forms » How to create a "Search Form"
How to create a "Search Form" [message #83898] Mon, 29 December 2003 00:54 Go to next message
DBA
Messages: 7
Registered: December 2003
Junior Member
How do i create a search-form in forms 6i?

I now have one block with three items in it:
Search_criteria, Search_button and result.

When-button-pressed is currently like this:

DECLARE
dummy varchar2(50);
cursor c2 is
select dum from table
where dum like :search_criteria||'%'
group by dum;
BEGIN
if not c2%isopen then
open c2;
end if;
fetch c2 into dummy;
while c2%found loop
:result := dummy;
next_record;
fetch c2 into dummy;
end loop;
close c2;
END;

It doesn't work very well, if i pres the button once, results come allright, but if i put another search criteria and pres the button again, the old record may still be around in result -item.

The block has value 6 in "Number of records displayed" and result-item has value 6 in "Number of items displayed".

Also, how do i identify each row, if i want to select one result and get some information based on that one result?

Am I totally in wrong direction with this search form-thing?

-DBA-
Re: How to create a "Search Form" [message #83900 is a reply to message #83898] Mon, 29 December 2003 04:57 Go to previous messageGo to next message
magnetic
Messages: 324
Registered: January 2003
Senior Member
procedure seems ok.
use the next if the search_criteria is a part of the string:
where dum like '%'||:search_criteria||'%'

before pressing the button, you should clear the resultblock [[clear_block('blockname');]]

use the primary- or foreignkey to identify a record of the result set.
Re: How to create a "Search Form" [message #83905 is a reply to message #83900] Mon, 29 December 2003 20:54 Go to previous messageGo to next message
DBA
Messages: 7
Registered: December 2003
Junior Member
I had only one block previously, and i could not get clear_block to work. Now i have two different blocks and the whole search-form seems to be working ok.

Thank you very much, magnetic.

-DBA-
Re: How to create a "Search Form" [message #261310 is a reply to message #83905] Wed, 22 August 2007 05:26 Go to previous messageGo to next message
sispk6
Messages: 164
Registered: November 2006
Location: pakistan
Senior Member
you dont need to create two seperate blocks
---- dont use clear_block();
------------------------------
instead for every search simply write
=====================================
  go_block('');
  first_record;

----------------------
it will move to first record and replace the old values with the new ones'
regards


PEACE
Re: How to create a "Search Form" [message #261323 is a reply to message #261310] Wed, 22 August 2007 05:47 Go to previous message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You are answering 4 years (!!!) old questions.
Previous Topic: problem of stacked canvas and radio button
Next Topic: appropriate trigger
Goto Forum:
  


Current Time: Mon Mar 10 11:44:50 CDT 2025