Home » Developer & Programmer » Forms » button search
button search [message #574078] Sun, 06 January 2013 14:34 Go to next message
goldray
Messages: 104
Registered: December 2012
Senior Member
Hi,
I have a tabeau that contains the data on my database, and I above table a "search" button that allows you to search for my DB, the problem must be the Result shown in the table or it already contains records!
what should I do?
Re: button search [message #574082 is a reply to message #574078] Mon, 07 January 2013 00:07 Go to previous messageGo to next message
Littlefoot
Messages: 19811
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I don't understand a word you are saying.
  • What is a "tabeau"?
  • "Search for my DB" is, I suppose, wrong terminology (I noticed that in your previous messages, but didn't pay attention): I *think* that "DB" is, actually, an Oracle "table" that resides in your schema. Is that so, or are you really searching through the whole database?
  • The last part of that sentence ("the problem must be ...") means what, exactly?

So, what should you do? Try to compose a meaningful and understandable message, for beginning.
Re: button search [message #574110 is a reply to message #574082] Mon, 07 January 2013 04:29 Go to previous messageGo to next message
goldray
Messages: 104
Registered: December 2012
Senior Member
hi,
sorry I made syntactic errors in my previous publication ..

in my interface I have a table that contains all the recorded ,and I have a "search" button ...
I want when I press this button, the result will be displayed in the table.
So what should i do ?
Re: button search [message #574111 is a reply to message #574110] Mon, 07 January 2013 04:39 Go to previous messageGo to next message
Littlefoot
Messages: 19811
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Again, you are reinventing the wheel. How many times did we tell you that Forms does that for you?
- create a from (use data block wizard)
- don't write any code, none. No buttons. Nothing.
- run a form
- press <Enter query> button in a toolbar
- enter search criteria
- press <Execute query> button in a toolbar

If you, however, insist, then put EXECUTE_QUERY into button's WHEN-BUTTON-PRESSED trigger.
Re: button search [message #574112 is a reply to message #574111] Mon, 07 January 2013 04:48 Go to previous messageGo to next message
goldray
Messages: 104
Registered: December 2012
Senior Member
you do not understand what I want ..
the table already contains the result of "execute_query" but I want when I press on the "search" button the new result will be displayed in the table ..
Re: button search [message #574113 is a reply to message #574112] Mon, 07 January 2013 05:05 Go to previous messageGo to next message
goldray
Messages: 104
Registered: December 2012
Senior Member
code of button "search":
declare 
cursor cur is select id,ename from emp where ename like ':search.item1';
begin
go_block('emp');
//i want to display the result of query in the block emp 
...

Re: button search [message #574117 is a reply to message #574113] Mon, 07 January 2013 05:21 Go to previous messageGo to next message
Littlefoot
Messages: 19811
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You are right - I don't understand you at all ...

goldray

the table already contains the result of "execute_query"

Which table? Who/what put execute_query results into that table and, above all, why?!?

goldray

when I press on the "search" button the new result will be displayed in the table

Nothing is displayed in a table. Table is a database object; it contains data. Front end (whether SQL*Plus, TOAD, your Forms application, whatever) DISPLAYS data stored in a table. So, is it the old wrong terminology issue? Is your "table", actually, a "tabular form layout" form block?

What do you need that cursor for? Are you SURE that it really does something (single quotes around :search.item)? If it is a data block, inserting records from a cursor into it will bring new problems (different FRM- error messages, such as "Do you want to save changes", possibly unique constraint violation and similar).

Unless you convince me opposite, I think that what I posted in the message #574111 is still valid. You enjoy in making simple things complex (and I'm unable to get the point).
Re: button search [message #574118 is a reply to message #574117] Mon, 07 January 2013 05:37 Go to previous messageGo to next message
goldray
Messages: 104
Registered: December 2012
Senior Member
I will explain in detail what I want ...
I have an interface that contains a tabular which contains records:
example:
123 Ryan
741 james


and I have a field named "item1" which contains default "%", for example, if this field I typed "% n" then I click on the "search" button in the tabular I have only this recording
123 Ryan
Re: button search [message #574120 is a reply to message #574118] Mon, 07 January 2013 05:47 Go to previous messageGo to next message
Littlefoot
Messages: 19811
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
As I already said: Forms is capable of doing that.

- press <Enter query> button in a toolbar
- enter search criteria (type %n into the "employee name" item)
- press <Execute query> button in a toolbar

As you don't want it simple, then (in "Search" button's WHEN-BUTTON-PRESSED trigger): based on search item's value, compose a WHERE clause and - using SET_BLOCK_PROPERTY built in - create data block's DEFAULT_WHERE (or ONETIME_WHERE) property. Navigate to data block (GO_BLOCK) and EXECUTE_QUERY.
Re: button search [message #574123 is a reply to message #574078] Mon, 07 January 2013 06:05 Go to previous messageGo to next message
goldray
Messages: 104
Registered: December 2012
Senior Member
i didn't understand the property default_where (i consulted same the help :f1)
set_block_property('emp',default_where,....//what do I put here);
Re: button search [message #574130 is a reply to message #574123] Mon, 07 January 2013 06:23 Go to previous messageGo to next message
cookiemonster
Messages: 11202
Registered: September 2008
Location: Rainy Manchester
Senior Member
The where clause you want to be applied to the select statement that forms issues to the database.
Since your requirement still isn't clear to us we can't really tell you what to put.
Re: button search [message #574169 is a reply to message #574130] Mon, 07 January 2013 10:01 Go to previous messageGo to next message
goldray
Messages: 104
Registered: December 2012
Senior Member
Thank you All Smile
the issue 's solved ..
just a question:
how I can use the apostrophe ' ?
example:
set_block_property('emp',default_where,'where ename like '%m' ');
Re: button search [message #574181 is a reply to message #574169] Mon, 07 January 2013 12:45 Go to previous messageGo to next message
joy_division
Messages: 4546
Registered: February 2005
Location: East Coast USA
Senior Member
goldray wrote on Mon, 07 January 2013 11:01

how I can use the apostrophe ' ?


You would use 2 apostrophes to represent one.
''
instead of
'
Re: button search [message #574188 is a reply to message #574181] Mon, 07 January 2013 13:25 Go to previous message
goldray
Messages: 104
Registered: December 2012
Senior Member
thank you Wink
Previous Topic: phone number format
Next Topic: error in signature
Goto Forum:
  


Current Time: Thu Nov 27 00:00:51 CST 2014

Total time taken to generate the page: 0.05100 seconds