Dominik's Tips and Tricks in APEX#1 
(in short DTaTiA#1 🤷‍♂️)
Dynamic LOV depending on previous column selection in e.g. Interactive Grid

Dominik's Tips and Tricks in APEX#1 (in short DTaTiA#1 🤷‍♂️) Dynamic LOV depending on previous column selection in e.g. Interactive Grid

I have already encountered the question several times: Is it possible to create a dynamic LOV depending on the selection from the previous field or column on a page?

You can approach the topic in several ways, for example you can use dynamic actions to show and hide a given element on the page. However, then you need to create at least 3 items, one to select the LOV, the other two to show a given item with the appropriate LOV assigned to it.

You can also try solutions like:

apex.item( "ITEM_NAME" ).hide();

or

apex.item( "ITEM_NAME" ).show();

But I think I managed to find a relatively universal solution, you can use them in items, for example in columns in Interactive Grid.

We create our basic Interactive Grid.

The effect we want to achieve is by selecting the LOV name in the 'Select LOV' column, the values that we can select in the 'LOV dynamic value' column will depend on the selection in second column -> 'Select LOV'.

Here are a few simple steps to achieve this:

  1. In the 'Select LOV' column we create a static select list with the names of our LOV's:

  2. In the 'LOV dynamic value' column we create a select list based on SQL Query:

with
    lovs (lov_id, lov_return_value, lov_display_value)
    as 
        (select distinct 
            1, -- number of LOV from 'Select LOV' column
            status, -- return value, could be e.g. ID
            status -- display value
        from EBA_DEMO_IR_PROJECTS
         union all
         select distinct 
            2, 
            project, 
            project 
        from EBA_DEMO_IR_PROJECTS)
select lov_display_value d, lov_return_value r
  from lovs
 -- Cascading LOV's to second column -> 'Select LOV':       
 where lov_id = :NOTATKI
  1. Below we mark the most important option for the third column -> 'LOV dynamic value': connection with the second column -> 'Select LOV':

  2. Click 'Save and Run Page' button -> it should work! :)

The solution we should get:

After selecting the name of the first LOV in the 'Select LOV' column, in my case 'Project', a list of projects should appear in the 'LOV dynamic value' column:

Similarly, after selecting the name of the second LOV, in my case 'Status', a list of statuses should appear:

The solution is simple and works flawlessly. And I somehow like simple solutions in APEX.

This is my first entry in the Tips & Tricks series, from time to time I will try to post various interesting facts and simple but useful solutions in APEX on the blog.

Thank you for your attention.

Stay tuned for more posts.

Â