Search code examples
oracleoracle-apexapex

Oracle Apex passing item results from a Select list to another Select list on the same page


I have two Select list on a single page and I have a very basic sql in the first Select list that will return the following:

Select List 1

Select Cause as D , causeid as R from xyz

example results

a = 1
b = 1
c = 2
d = 3

And in the second Select List I would like to only load what the user selects in the the first. So if the user selects c in the first I only want to load

C = 2 i

n the second Select List which is the results of the first Select List.

Thanks for any help.

I tired to set the DEFAULt of the second Select List to the First.

:SelectList1;

Solution

  • If I understood you correctly, the 2nd LoV query is supposed to filter rows based on result of value selected in the 1st Lov. If that's so, that's called cascading.

    Your example is rather dummy (a, b, c, ...). A better example is

    • 1st LoV selects continents (let's presume that item name is P1_CONTINENT)

      select name, id
      from continents
      
    • 2nd LoV selects countries (let's call it P1_COUNTRY) on continent selected in the 1st LoV

      select name, id
      from countries
      where continent_id = :P1_CONTINENT
      

      But that's not all - you have to put P1_CONTINENT into "Parent item(s)" property in "Cascading list of values" section of P2_COUNTRY item.

    enter image description here