X

The Oracle APEX blog is your source for APEX news, technical tips and strategic direction

Faceted Search Enhancements in APEX 20.2

Monica Godoy
Principal Product Manager

Faceted Search was introduced in APEX 19.2 allowing users to filter information easily and intuitively by selecting the options in each facet. For APEX 20.2 the APEX Development Team has included great enhancements to this region. Let's explore them.

Facet Charting

This feature allows developers to include a chart for each facet in the Faceted Search page. When the user clicks on the Show Chart button, the chart displays the facet value counts for that specific facet. Users can choose between a bar (by default) or a pie chart. Keep in mind that region level Show Counts attribute must be on for Show Charts to have any effect.
Some of the new region attributes are:

  • Show Charts. Available options include:
    Popup: A Show Chart button is added to the facet header. When users click the button, it displays the chart in a non-modal dialog.
    No: Showing the chart is disabled in general.
    Selector: A selector is required on the page where charts will be added. This allows showing multiple charts in the same region.
     
  • Charts Selector. This is the selector of an element on the page where the Faceted Search region will display facet charts. This attribute is available when Show Charts is selected as Selector.
     
  • Display Chart for Top N Values. Provide the number of values to display in the chart for each facet. A value of 10 means that the facet charts will show the first 10 items. When Sort By Top Count is on these are the top values, based on occurrence counts. The default value is 10.
     
  • Show Chart. Specify whether to show the count of occurrences of the list entries as a chart. This attribute only applies if the region attribute Show Charts is equal to Popup or Selector.
     
  • Show Chart Initially. Specify whether the chart is being displayed initially. This attribute only applies if the region attribute Show Charts is equal to Selector.

Facet Groups

This feature was created to support tables that contain multiple Boolean type columns. You can create checkbox facets for each of these columns and those can be grouped so that it looks like a single facet.

Let's see how to customize and take advantage of these new attributes.

Create a Faceted Search page

  1. Navigate to your application and click Create Page.
  2. Select Report and click Next.
  3. Select Faceted Search and click Next.
  4. Enter the name of your page, select the breadcrumb and click Next.
  5. For navigation menu, create a new navigation menu entry and click Next.
  6. Select the source of your data. For this example, I'm using the local table EMP, to which I have added these "flags" columns:
    REMOTE_WORKER_YN
    ABLE_TO_TRAVEL_YN
    PAID_LEAVE_YN
  7. For Display As, select Report.
  8. Lastly, select the facets you need to include in the report. Scroll down to see the full list of facets.
    In addition, if the wizard doesn't suggest any column, click the Refresh button to provide recommendations.
  9. Click Create.

When you run the page initially, you will notice the Show Chart buttons at the header of the facets:

By clicking on Pie Chart, you can change the type of char for the same facet.

Customize the Faceted Search page

Users see charts in a non-modal dialog by default, by clicking each button they can see the information as an individual chart and when users select other facet values the opened chart is updated in real time. But there's another way to view charts, such as a dashboard mode, where multiple charts can be shown in the same region. To enable that option:

  1. Drag a new Static Content region and drop it after the Button Bar region.
  2. For name, enter Dashboard.
  3. For text, enter:
    <div id="Dashboard"></div>
    
     
  4. Navigate to the attributes of the Faceted Search Region. In this version, you will find attributes in the third panel (at the right).
  5. For Show Charts, select Selector.
  6. For Charts Selector, enter the id selector. In this example, I've entered #Dashboard.
  7. Navigate to the Dashboard region and click on Template Options.
  8. For General, check the option: Remove Body Padding.
  9. For Header, select Hidden.
  10. For Style, select Remove UI Decoration.
  11. Save changes.

When you run the page, you can click as many charts as you need and those are going to be displayed as a dashboard on the page.

Now, let's focus on the facets. At the moment I have four facets: Department, Salary, Manager, and Job. But remember that this particular table has some "flags" columns, which are characteristics of the Employee: Remote Worker, Able to Travel and Paid Leave. While it is possible to create a facet for each one, it is preferable to include all these characteristics in only one facet as a facet group. Let's take advantage of this feature below.

  1. Navigate to Faceted Search region.
  2. Right-click on Facets and select Create Facet Group.
  3. For Label, enter Characteristics.
  4. Navigate to the new checkbox created.
  5. For Name, enter PX_REMOTE_WORKER.
  6. For Settings, select Custom.
  7. For Checked Value, enter YES.
  8. For Database Column, enter REMOTE_WORKER_YN.
  9. For Data Type, select VARCHAR2.
  10. Create a new checkbox for Able to Travel and Paid Leave columns, using the following attributes:
Attribute Able to Travel Paid Leave
Name PX_ABLE_TO_TRAVEL PX_PAID_LEAVE
Settings Custom Custom
Checked Value YES YES
Database Column ABLE_TO_TRAVEL_YN PAID_LEAVE_YN
Data Type VARCHAR2 VARCHAR2


10. Save changes.

Let's run the page to see the new facet on the page:

This facet also includes a chart, which can be shown as a bar or pie chart.

Review some of these enhancements in the following video:

Tips

  • To sort the information by a specific column, such as the name of the employee, use the following declarative method:
  1. Navigate to the Classic Report region.
  2. Navigate to the column, in this case, ENAME.
  3. In the attributes of the column, navigate to Sorting.
  4. For Default Sequence, select 1.
  5. For Direction, select Ascending.
  6. Save changes.
  • If you make changes on Show Chart Initially or Display Chart for Top N Values attributes, you would need to reset the report or end the browser session to take effect when you run the page. The reason is that the chart configuration is stored in browser session storage and that takes precedence over a change in configuration. 
    The wizard generates a Reset button on Faceted Search pages, so that's the easiest way to see the changes in your page.
    Additionally, you can add your own link with cache-control RR (Reset Report). This will clear out all Faceted Search settings saved in browser session storage.

Summary

The Faceted Search feature has been enhanced since APEX 19.2, allowing developers to include more features to their applications in a declarative way, without adding hundreds of lines of code.
From the user's point of view, it's the easiest and intuitive way to filter data, including finding relevant business data in a visual and interactive way.

Note: Please remember that the value "X" in "PX_ITEM"  is dependent on the APEX page you're working on.

Join the discussion

Comments ( 1 )
  • Bhavin Adhvaryu Thursday, October 22, 2020
    Hello Monica,

    Nice blog and very well explained the new enhancement in Faceted Search in Apex v20.2.
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.