Home » Developer & Programmer » Forms » Search from db problemyp (oracle 10g, win7)
Search from db problemyp [message #589136] Tue, 02 July 2013 10:22 Go to next message
reallyoldturtle
Messages: 15
Registered: June 2013
Junior Member
Hi.
There is a table called cd_details. It has fields like id, name, language, type etc.
I need a form where the user can search the database on basis of language and name and then display the other details. I used a data block wizard and given a push_button with (execute_query). But it's very clumsy. For eg, if the user presses next the next button then all the records are being displayed. Is there any way to do this thing in a better way?
Thanks in advance.
Re: Search from db problemyp [message #589137 is a reply to message #589136] Tue, 02 July 2013 10:32 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
Why have you got a push button? - default toolbar should have execute query.
I don't understand what you mean by this:
Quote:

if the user presses next the next button then all the records are being displayed


[EDITED by LF: fixed [quote] tags]

[Updated on: Tue, 02 July 2013 15:44] by Moderator

Report message to a moderator

Re: Search from db problemyp [message #589138 is a reply to message #589137] Tue, 02 July 2013 10:41 Go to previous messageGo to next message
reallyoldturtle
Messages: 15
Registered: June 2013
Junior Member
for example if i type 'english' and execute query then the following details come:

name: the dark knight type:movies language: english.

but then if I press "next" then one by one all the records in the database come up.

also if i enter "englisH" instead of "english" still the dark knight details come up.
Re: Search from db problemyp [message #589139 is a reply to message #589138] Tue, 02 July 2013 10:42 Go to previous messageGo to next message
reallyoldturtle
Messages: 15
Registered: June 2013
Junior Member
yes the default toolbar has an execute query button. but i just want it to make user friendly by adding a "search" button which basically has "execute_query;"
Re: Search from db problemyp [message #589140 is a reply to message #589139] Tue, 02 July 2013 10:44 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
What does the next button do?
Do you understand how enter-query mode works? - if not read form builder help topics on it.
Re: Search from db problemyp [message #589141 is a reply to message #589139] Tue, 02 July 2013 10:45 Go to previous messageGo to next message
reallyoldturtle
Messages: 15
Registered: June 2013
Junior Member
It would be really helpful if you can guide me in how to properly search through a database. My method of searching is extremely sketchy.

[Updated on: Tue, 02 July 2013 10:45]

Report message to a moderator

Re: Search from db problemyp [message #589142 is a reply to message #589141] Tue, 02 July 2013 10:53 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
Go into enter-query mode. Enter the values you want to restrict the query by in the appropriate items. Execute query.

That's it. Forms does all the hard work for you. You don't normally need to write any code for querying.
Re: Search from db problemyp [message #589143 is a reply to message #589142] Tue, 02 July 2013 10:59 Go to previous messageGo to next message
reallyoldturtle
Messages: 15
Registered: June 2013
Junior Member
then how do i show a message "data not found" if some wrong inputs have been made?
Re: Search from db problemyp [message #589144 is a reply to message #589143] Tue, 02 July 2013 11:08 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
Does forms give a default message for that? (I can't remember and don't have a working copy handy)
Re: Search from db problemyp [message #589150 is a reply to message #589144] Tue, 02 July 2013 15:55 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Yes, it does (FRM-40301 - query caused no records to be retrieved. Please re-query) (or something like that; I don't have access to English version at the moment).

As of other issues mentioned in this discussion: by default, I believe Forms is case-insensitive. That's why "english" and "ENgliSH" return the same record set).

<Next> that returns other records: when you execute query for "english", Forms returned all records from that table that satisfy condition you entered. If your form's layout is "form", you see only one record at a time, but <Next> (or <Prev>) enables you to scroll through other records returned by a query. If form layout was "tabular" and you set it to display, say, 10 records, you'd see (up to) 10 records retrieved. You'd still be able to scroll through them (using <Next> / <Prev> or by creating a vertical scrollbar).
Re: Search from db problemyp [message #589152 is a reply to message #589150] Tue, 02 July 2013 16:06 Go to previous messageGo to next message
reallyoldturtle
Messages: 15
Registered: June 2013
Junior Member
Thanks a lot sir. You All are extremely helpful.

I will try it tomorrow and i think it should work now. I ll add an exception showing an alert box then.

Also one last thing, is there any way i can disable insert, update and delete ?
Re: Search from db problemyp [message #589153 is a reply to message #589152] Tue, 02 July 2013 16:10 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Yes; set these data block properties (in block's Property Palette window) to "No".
Re: Search from db problemyp [message #589154 is a reply to message #589153] Tue, 02 July 2013 16:31 Go to previous messageGo to next message
reallyoldturtle
Messages: 15
Registered: June 2013
Junior Member
Thanks a lot sir.
Re: Search from db problemyp [message #589229 is a reply to message #589154] Wed, 03 July 2013 09:38 Go to previous message
reallyoldturtle
Messages: 15
Registered: June 2013
Junior Member
They all worked fine!

And regarding the data not found, the forms gives a message(40301), So i checked for the message in on-message trigger.
Previous Topic: forms -alert
Next Topic: report problem
Goto Forum:
  


Current Time: Fri Apr 26 14:44:42 CDT 2024