Discussions
Categories
- 196.8K All Categories
- 2.2K Data
- 239 Big Data Appliance
- 1.9K Data Science
- 450.3K Databases
- 221.7K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 550 MySQL Community Space
- 478 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3K ORDS, SODA & JSON in the Database
- 544 SQLcl
- 4K SQL Developer Data Modeler
- 187K SQL & PL/SQL
- 21.3K SQL Developer
- 295.9K Development
- 17 Developer Projects
- 138 Programming Languages
- 292.5K Development Tools
- 107 DevOps
- 3.1K QA/Testing
- 646K Java
- 28 Java Learning Subscription
- 37K Database Connectivity
- 155 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.1K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 18 Java Essentials
- 160 Java 8 Questions
- 86K Java Programming
- 80 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 204 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 439 LiveLabs
- 38 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 171 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 232 Portuguese
How to create text field with autocomplete, for each word?

Hi everyone,
Currently Apex' text field with autocomplete treats user's input as a whole. I want to create an autocomplete field where user can get suggestion for each word, similar to how Google search gives suggestions for each word. Is there a workaround to achieve this in Apex? Any feedback will be appreciated!
I am using Apex v5.1. Thank you.
Answers
-
Use a Pipeline Function.
Inside the Function
- split the string into words ( x := apex_util.string_to_table)
- get last word ( w := x( x.count ) )
- do your "suggested words" SQL and loop results ( where word like w || '%' )
- append the new letters to the input string
- PIPE ROW( ... )
- end loop;
- return;
MK
-
Go into my application page 8, I have a search box that acts like a suggest list. To test, enter some text in the search box.
----
Workspace: ladevapex
User Name: mydevfellow
Password: Pa$$word1
-
Hi, I have successfully logged in to the workspace, but when I tried to run Page 8 it keeps asking for username/password again. And it seems they are different from the workspace's username/password?
-
When you log into the workspace, you are login as a developer. On the other hand, when you run the application, you need to login as a user. In this case, you can enter the same developer credential one more time to test the application.
-
Hi LA County, I tried your search box. It indeed gave me suggestions, but not for each separate word I am typing for (as I pointed out in my question).
To elaborate my Google Search example, if I typed "ora", the search field might give suggestion "oracle". And then if I typed "oracle ap", it continues giving another suggestion: "oracle apex". So it should gives suggestion for each separate word.
-
You can modify the query to get what you need. And this is the query structure I created for this sample:
create or replace function sellist(p_search in varchar2)
return varchar2
is
l_list varchar2(32767);
cursor l_cur is
select *
from employees
where employee_id || '-' || upper(first_name || ' ' || last_name) like '%' || upper(nvl(p_search,'~~')) || '%'
and rownum < 11
order by first_name;
begin
for i in l_cur loop
l_list := l_list || '''' || i.employee_id || ':' || i.employee_id || '-' || i.first_name || ' ' || i.last_name || ''',';
end loop;
return l_list;
end sellist;
-
I may need some help in figuring out what is on.
The PIPELINED function works as expected:
But the "Text with Autocomplete" item does not seem to be sending the string to get the list.
vs
no, I haven't checked any logs... yet.
I'd just thought I'd "pipe" in with an example of what I stated.
MK