Home » Developer & Programmer » Forms » search using drop down list (oracle 10g)
search using drop down list [message #575763] Sun, 27 January 2013 04:38 Go to next message
furqan
Messages: 115
Registered: January 2012
Location: Hyderabad
Senior Member
Dear sir,

i have a tabular form based on table namely mm_dtl.
in that form i created two text_item.one is drop down list
with values such as sbno,desc,pno,desc1,pno1(columns names),and
another text_item is just unbound one.

when i select sbno in first text_item from list and enter sbno in second
text_item..then all the record with sbno entered in second text_item shud
get display in tabular form.same like this for other values of the list.

please guide.
Thanks.
Re: search using drop down list [message #575779 is a reply to message #575763] Sun, 27 January 2013 12:21 Go to previous messageGo to next message
Littlefoot
Messages: 19693
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
How are SBNOs you put into the first text item and into the second text item related? Why do you have two items for the same thing (SBNO)? What is the purpose of the second text item? Why do you put SBNO into the first item if you are selecting records based on the second text item (so the first one is, obviously, unimportant)?

What's wrong in
- enter query mode
- select SBNO into the first item
- execute query
Re: search using drop down list [message #575790 is a reply to message #575779] Sun, 27 January 2013 22:38 Go to previous messageGo to next message
furqan
Messages: 115
Registered: January 2012
Location: Hyderabad
Senior Member
thanks for your reply sir..

as i said text_item1 is a drop down with values sbno,desc1.
in the text_item1 user will select sbno and in text_item2 value of sbno for eg.1234
so all the records with sbno-1234 should get display.

same if the user select desc1 in text_item1 and enter the value of desc1 in text_item2 for eg. v_belt
all the records with v_belt as desc1 shud get displayed.

thanks.

[Updated on: Sun, 27 January 2013 22:40]

Report message to a moderator

Re: search using drop down list [message #575799 is a reply to message #575790] Mon, 28 January 2013 00:59 Go to previous messageGo to next message
Littlefoot
Messages: 19693
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
One option is to set data block's DEFAULT_WHERE (or ONETIME_WHERE) property using SET_BLOCK_PROPERTY built-in. You'd use both text items to do that, as it appears that conditions - both left & right side - are subject to change. The whole thing can be rather complex, depending on data types (for example, character columns require single quotes, date values need to have correct format mask, etc.).

Therefore, create another (rather long) text item and put the result of your WHERE clause in there so that you'd see it properly and visually check whether it is correctly written or not. Because, if it is no, query won't return anything but an error message.
Re: search using drop down list [message #575830 is a reply to message #575799] Mon, 28 January 2013 04:59 Go to previous messageGo to next message
furqan
Messages: 115
Registered: January 2012
Location: Hyderabad
Senior Member
i tried KEY_NEXT_ITEM trigger on text_item2

if :text_item1 is not null and :text_item1='sbno ' then
set_block_property('mm_dtl',default_where,'sbno='||:text_item2);

end if;

not giving any error but nothing is getting executed.
help

thanks
Re: search using drop down list [message #575833 is a reply to message #575830] Mon, 28 January 2013 05:12 Go to previous messageGo to next message
Littlefoot
Messages: 19693
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Did you execute query on MM_DTL block, either directly (by pushing the toolbar button, using keyboard shortcut) or programatically (by issuing EXECUTE_QUERY on that block)?
Re: search using drop down list [message #575835 is a reply to message #575833] Mon, 28 January 2013 05:25 Go to previous messageGo to next message
furqan
Messages: 115
Registered: January 2012
Location: Hyderabad
Senior Member
yes just now i tried

go_block('mm_dtl');
execute_query;

nothing new....

if iam executing it from toolbar..all the records in the table are displayed.

thanks.
Re: search using drop down list [message #575838 is a reply to message #575835] Mon, 28 January 2013 05:38 Go to previous messageGo to next message
Littlefoot
Messages: 19693
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Here:
Quote:

if :text_item1 is not null and :text_item1='sbno ' then

is a space character behind SBNO. That's most probably wrong. Which means that IF was FALSE and no property was ever set.

As I said: display WHERE clause so that you could see it. Copy/paste it into SQL*Plus and run the SELECT statement with such a condition. If it works in SQL*Plus, it will (most probably) work in Forms as well.
Re: search using drop down list [message #575844 is a reply to message #575838] Mon, 28 January 2013 06:07 Go to previous messageGo to next message
furqan
Messages: 115
Registered: January 2012
Location: Hyderabad
Senior Member
hey..now its working fine when i remove the spaces.

but the thing is when i selecting sbno its fine.
but when iam selectind desc1 in text_item1 and typing
value of desc1 in text_item2 its giving error.ORA-00904 :"ERT568":INVALID IDENTIFIER.

if iam typing ERT568 in text_item2 along with single codes working fine.

guide me...last step..

thanks


Re: search using drop down list [message #575846 is a reply to message #575844] Mon, 28 January 2013 06:35 Go to previous message
Littlefoot
Messages: 19693
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Why don't you read what I say and do what you were told?

Me, some time ago

The whole thing can be rather complex, depending on data types (for example, character columns require single quotes, date values need to have correct format mask, etc.).

Therefore, create another (rather long) text item and put the result of your WHERE clause in there so that you'd see it properly and visually check whether it is correctly written or not. Because, if it is no, query won't return anything but an error message.


So concatenate single quotes with that string! I told you that different datatypes behave differently, didn't I?
Previous Topic: running application from browser
Next Topic: Trying to get data in Excel sheet from Oracle reports 10g
Goto Forum:
  


Current Time: Thu Oct 23 07:05:52 CDT 2014

Total time taken to generate the page: 0.10620 seconds