oracle-apex

Oracle Apex How to use date column in item filters


I have an Interactive grid:

select emp_id, emp_name, joining_date from employees 
where (:P1_EMP_NAME ='All' or :P1_EMP_NAME !='All' and emp_name=:P1_EMP_NAME);

On top of it i have a filter.

P1_EMP_NAME-> Select list->

select emp_name d, emp_id store from employees;

The EMP_NAME search is already configured.

I have FIND button which on click submits the P1_EMP_NAME item and refreshes grid..

I need to configure similar filter using joining_date: P1_JOINING_DATE.

But i want to understand how do i dispaly dates in item and how can i configure in query such that the date selected filter IG query accordingly?


Solution

  • Page items do not have a "data type" that maps to the database data types. All page items are strings in a browser context. A page item like "Number field" just ensures the browser renders the correct directives for a number field but it doesn't really map to the NUMBER data type. The values that is passed from the html page is implicitely or explicitly casted to the correct datatype by the apex engine.

    If you have a page item that contains a date, then it's advised to do a TO_DATE(:P1_PAGE_ITEM,'<your_date_format') in the query to ensure that the bind variable is correctly interpreted as date.