When it comes to user experience, filling in metadata when submitting content is not the most enjoyable task. But I think most agree how useful metadata becomes when it comes to finding content. So making that experience better and easier should always be a goal.
One technique that has been around for a while and is more and more prevalent is the autocomplete (aka type-ahead). Autocomplete is when you are typing in an input field and suggested choices are offered to you based on the characters you have typed. It can make offer those choices either based on a pre-defined library or based on users’ past values. This allows you to keep the metadata field very fluid (not a strict option list), but also maintain some consistency among values entered. This is perfect for fields such as ‘Keywords’ or ‘Tags’.
So let’s look at how we can provide that type of functionality to WebCenter Content metadata fields.
Typically, in those types of fields, there is often more than one value entered. If you look at how WebCenter Content stores those values, it’s done as comma-separated values stored within a single table cell.
So, if the goal is to provide a set of suggested values, it must pull them from multiple values in a cell from multiple rows. This provides a bit of a challenge. But with some creative SQL, it’s possible to extract those values separately and organize them into their own rows of data in the result set. Once we have the data in this format, the rest is fairly straightforward to deal with.
Below is a sample SQL query to get us the data in that format:
select distinct initcap(lower(trim(substr(xKeywords, instr(trim(xKeywords),’,’,1,rr.r)+1, instr(trim(xKeywords),’,’,1,rr.r+1)-instr(trim(xKeywords),’,’,1,rr.r)-1 )))) xKeywords from (select ‘,’||xKeywords||’,’ xKeywords, length(xKeywords)-length(replace(xKeywords,’,’,”))+1 cnt from DocMeta ) DocMeta, (select rownum r from all_objects where rownum <= 50) rr where rr.r <= DocMeta.cnt order by 1;
Now when we run the query against those multivalue metadata fields, we get the data back in separate rows:
The rest of the work is all done through the UI. In my example, I found that the jQuery UI Autocomplete widget provided a great sample to work with. So then it’s a matter of querying the data, creating the result set in JSON format for the widget, and then targeting the .autocomplete function to the metadata field.
Now when a user is checking in or updating a content item, then can begin to see a list of suggested values based on what has been entered before:
I’ve packaged my sample as a component if you’d like to try it yourself. Please see the readme.txt for configuration details.
Note: This article is taken directly from the Oracle A-Team blogs – https://www.ateam-oracle.com/post/autocomplete-for-metadata-in-webcenter-content
Is your organization looking to enhance your current WebCenter environment for optimal user use? Contact Inspired ECM to learn how we can help.