Smart Filters

Ashish Sahay Jun 22, 2022 4:14:25 PM

"Smart Filters" is a region-type component added in APEX 21.2. It provides end-users with numerous filters that narrow search results at run-time.

Smart filters are handy, easy to use and, of course, enhance user experience. It has suggestions based on existing data that can be used as an easy filter. Since Smart Filters provides suggestions (or I should say smart suggestions), the user can control the dataset with just a few clicks.

This blog explores the Smart Filters component in Oracle APEX 21.2 and how you can use it for simple and effective solutions.

sf1

Features

Powerful Search Bar

Smart Filters features a powerful new search bar that provides built-in auto-complete for your filters, supports searching for multiple terms, and provides easy keyboard navigation.

 

Search Suggestions

Search suggestions are at the heart of Smart Filters. These suggestions are based on the filters you have defined and are displayed as you type, or as chips below the search bar.

Suggestion Chips

Filters are evaluated against your data and displayed below the search bar as chips, suggesting the top search filters most appropriate for your dataset.

 

How to create Smart Filters

  1. Go to your Application and create a new page
  2. Select Report Component and then select Smart Filters
  3. Select Navigation as per your app preferences
  4. Now choose your table for report like EMP

smart filters

sf3

sf4

sf5

When you are setting up your Report, APEX will suggest you add Filters. The above screenshot demonstrates the Smart Filters to choose from based on the data available in the table:

  • JOB – Checkbox
  • SAL – Range
  • DEPTNO – Checkbox

You can deselect as per the requirements; however, APEX selects them by default based on the data available in the table.

 

Available Chips Type

  1. Search
  2. Checkbox Group
  3. Input Field
  4. Range
  5. Radio Group

sf6

After the successful creation of the page, we are ready to run. Since we have selected the three filters: JOB, Salary and Department, they are added to the Smart Filters suggestion list.

Now we have working Smart Filters, let’s try to play around with them.

sf7

Region Attributes

  • Maximum Suggestion Chips – Number of Suggestion Chips
  • More Filters Suggestion Chip – Display more options if Chip is hidden
  • Compact Numbers Threshold - Number amounts compact e.g. 1K, 2K
  • Show Total Row Count – Display Row Count available in the report.
    For Label You can provide a Custom label or APEX will use APEX.FS.TOTAL_ROW_COUNT_LABEL text message.

Customizing Smart Filters

Chip Icons - We can change the Chip Icon displayed when we click on the search box.

sf8

Search Type Filter

  • Collapsed Search Field by default to save extra space.
  • Search Type: Row Search and Oracle Text are supported
  • Database Column(s): Select as many columns as you want.
  • Placeholder: The default placeholder is Search. Under appearances, we can overwrite the placeholder

Search Type Filter is a great fit for allowing the use of free text input to filter out data. It takes the full space of an item (text field) on screen; however, we have an option to collapse it if not in use.

Range Type Filter

  • List of values: Range type needs a combination of lower and upper limits separated by pipe ”|” for a range:
    |900 - Here we have a null lower limit and 900 as an upper limit
    900|1300 - Here we have 900 lower and 1300 as an upper limit
  • Suggestion Type: For all filters types except the Search field we can customize the suggestions:
    Dynamic: It takes the values from Report Dataset
    Static: You can define it if the values are so low like Yes/No. Dynamic would hamper the performance.
    Query: It is based on the Query you have provided.
    None: No Suggestions

Demonstration

A demo of Smart Filters can be viewed here.

Log in using the username: Admin.

 

Summary

Smart Filters are a handy and user-friendly search component to narrow down a dataset. They give a simple and effective solution to work on target data. We can use it as a global search for an application or on any page, using minimal whitespace. In APEX 21.2 Oracle rearranged the page structure, now we can move the filters to the navigation bar. They allow the end-user to search from anywhere in the application. For modern web development, Smart Filters should be considered for any APEX enquiry or search screens.

 

To find out more about Oracle APEX, email us at enquiries@dsp.co.uk or book a meeting...

Book a Meeting