Search code examples
oracleoracle-apexoracle-apex-19.1oracle-apex-19.2

How to Enable or Disable button in a column based on other column's value in Oracle Apex?


I'm working on an app in Oracle Apex. I have an Interactive Report based on the following query.

SELECT NAME, DATE, '' LINK_TO_PAGE
FROM APPLICATIONS

From the above query we can see that I have 2 columns(Name, Date) from the table Applications and an empty column(Link_to_page).

For the empty column Link_to_page I have set the attributes

  • Type : Link
  • Target : Page 2
  • Link Text : Apply
  • Link Attributes : class="t-Button t-Button--simple t-Button--hot t-Button--stretch"

What I want to do is disable the button in the Link_to_page column if the sysdate is greater than the date in the Date column.

How can I accomplish this?


Solution

  • One option is to do it directly in query, e.g.

    select name, 
           date, 
           case when sysdate > date then null
                else '<span class="t-Icon fa fa-box-arrow-out-ne"></span>'
           end link
    from applications
    

    (Note that date is an invalid column name in Oracle; it is reserved for datatype).

    LINK column's

    • type = Link
    • Link's
      • target = Page 2
      • link text = #LINK#
      • link attributes = class="t-Button t-Button--simple t-Button--hot t-Button--stretch"

    and that's it ... CASE will make sure that button isn't even displayed (so it won't actually "disable" it, as you wanted). See if it helps.