Home » Developer & Programmer » Forms » How to call Matching Record (9i, 9.0.1.1, XP)
How to call Matching Record [message #661227] Sat, 11 March 2017 07:16 Go to next message
billgates
Messages: 19
Registered: March 2017
Junior Member
Hey fellas I have database 9i 9.0.1.1 with Forms 6i.

I have a form with two text items ITEM_A, ITEM_B.
ITEM_B calls Description from the following table.

SQL> SELECT * FROM IMS_ITEMCATEGORY;

CATCODE DESCRIPTION
---------- ---------------------
01 ENGINE
02 TRANMISSION
03 SUSPENSION
04 ELECTRICAL
05 INTERIOR
06 EXTERIOR
07 BRAKING
08 ACCESSORIES
09 SEALS
10 FILTERS
11 BELTS
12 FASTNERS
12 OIL & LUBRICANT
13 rows selected

Now what I want is as I type a phrase in ITEM_A which contains a word from the description in the given table and press enter, The ITEM_B should be filled with the related description.
For Example

I type ""V BELT 2240"" in ITEM_A and press enter. The ITEM_B should be filled with the related category like ""BELTS"".
Now ITEM_A will have matching word like BELT but how many characters or words will come before or after it is a myth.

Do anyone have an idea how to do it?

[Updated on: Sat, 11 March 2017 07:17]

Report message to a moderator

Re: How to call Matching Record [message #661229 is a reply to message #661227] Sat, 11 March 2017 08:12 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Indent the code, use code tags and align the columns in result.

What is the relation between your ITEM_A, ITEM_B and the query you posted which has none of them?

Quote:
I type ""V BELT 2240"" in ITEM_A and press enter. The ITEM_B should be filled with the related category like ""BELTS"".
Now ITEM_A will have matching word like BELT but how many characters or words will come before or after it is a myth.
ITEM_A like '%'||rtrim(ITEM_B,'S')||'%'

Re: How to call Matching Record [message #661230 is a reply to message #661229] Sat, 11 March 2017 10:20 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You have two categories number 12. That's probably wrong.

What if there's a new category (14) whose description is 'BRAKING OIL', and user enters "OIL" into ITEM_A. Which "OIL" category will you display?
- 12 OIL & LUBRICANT, or
- 14 BRAKING OIL?

That's just an example (probably not a very smart one), but I hope you understand my point - there might be similar categories, and you have to pick only one; otherwise, your query will return the TOO-MANY-ROWS error.
icon14.gif  Re: How to call Matching Record [message #661231 is a reply to message #661230] Sat, 11 March 2017 12:06 Go to previous messageGo to next message
billgates
Messages: 19
Registered: March 2017
Junior Member
haha that was a mistake. but solution was something else. thanks anyways
Re: How to call Matching Record [message #661232 is a reply to message #661231] Sat, 11 March 2017 12:24 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

What was it?

Re: How to call Matching Record [message #661234 is a reply to message #661232] Sat, 11 March 2017 13:20 Go to previous messageGo to next message
billgates
Messages: 19
Registered: March 2017
Junior Member
it was simple i used like'%%'
Re: How to call Matching Record [message #661235 is a reply to message #661234] Sat, 11 March 2017 13:22 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

This is silly, this means anything that is not null is the answer whatever is the input.

Re: How to call Matching Record [message #661243 is a reply to message #661234] Sat, 11 March 2017 15:03 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
billgates wrote on Sat, 11 March 2017 11:20
it was simple i used like'%%'
like '%'
would work as well
Re: How to call Matching Record [message #661245 is a reply to message #661243] Sun, 12 March 2017 01:07 Go to previous message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

"work" /forum/fa/449/0/

Previous Topic: change records visual attribute depending on certain conditions
Next Topic: get record group query
Goto Forum:
  


Current Time: Thu Mar 28 07:59:20 CDT 2024