Faceted Search and Smart Filters are powerful ways to filter and display your data, allowing users to set filters on the left or upper side of the screen.
In APEX 24.1, we introduced Date Picker support for Input Facets and Manual Range Inputs on Faceted Search and Smart Filters Regions, where you can set your own format mask for date representation.
Let me show you how you can customize your date picker depending on your needs with these three quick examples:
Range facet with a list of values.
Range facet using a start and end date.
Input field.
Install the EMP / DEPT sample dataset
In order to have some data to work on the examples, let's install a sample dataset.
Navigate to SQL Workshop > Utilities > Sample Datasets.
Click on Install for the EMP/DEPT dataset and follow the wizard steps.
Create an app
Navigate to App Builder and click Create.
Enter the name: Date Picker Support and click Use Create App Wizard.
Click on Add Page and select Faceted Search.
For name, enter Employees Report.
For table, select EMP.
Click Add Page.
Add more pages to your app as you need and once you are ready, click on Create Application.
Range facet with a list of values
In this example, users can check the proper checkbox to filter employees hired before 2024 or in 2024.
Create a new facet and enter the following:
Fig 1. Creation of a new facet
For name, enter PX_HIREDATE.
For type, select Range.
Switch on the select multiple attribute.
For icon, enter fa-calendar-edit
For list of values type, select Static Values.
For static values, enter:
Display Value
Return Value
In 2024
20240101000000|
Before 2024
|20240101000000
For database column, enter HIREDATE.
For data type, select DATE.
Range facet using a start and end date
This example allows users to enter a range of dates to filter the employee's hire date.
Create a second facet and enter the following:
For name, enter PX_HIREDATE2.
For type, select Range.
Switch off the select multiple attribute.
For label, enter Hiredate - Range.
For icon, enter fa-calendar-edit
For format mask, enter DD-MON-YYYY.
For database column, enter HIREDATE.
For data type, select DATE.
Input field
This last example, allows users to enter one specific date to filter employees hired on that date.
Create a third facet and enter the following:
For name, enter PX_HIREDATE3.
For type, select Input Field.
For format mask, enter DD-MON-YYYY.
For database column, enter HIREDATE.
For data type, select DATE.
After you have made the changes, click Save and Run Page.
You can also implement similar filter behavior on a Smart Filters page:
Mónica Godoy is a Senior Principal Product Manager for Oracle APEX.
Before she joined the APEX Team, she worked as an Oracle APEX Consultant, modernizing Oracle Forms apps and developing new applications with Oracle APEX. Mónica also encourages women to be part of the APEX Community at www.womeninapex.com.