Search code examples
oracle-apex

Oracle Apex Derive Status based on dates


I have an interactive grid with the following columns:

select emp_id,active,start_date,end_date from emp;

Active
Start Date
End Date

If End Date < Current Date, the Status column should display Inactive else active. Status is a Display only column and would just display Active/Inactive based on the condition.

How and where can i add this validation?


Solution

  • That's not a validation, but another column in interactive grid's query; case expression is simple enough:

    select emp_id, active, start_date, end_date,
      --
      case when end_date < sysdate then 'Inactive'
           else 'Active'
      end status
    from emp
    

    Then navigate to status column and turn its "Query only" property ON because it isn't based on database column and you don't want Apex to try to submit it along with other columns.