Search code examples
oracleoracle-apexapex

how to list different values in select lists that using same shared components? (select lists are in different pages)


first of all and i have two pages and oneshared component for select list and its query for example like this

select * from table_vehicles

when i open the first page, i want to list car brands in table_vehicles when i open the other page i want to list bicycle brands in table_vehicles i tried to use page item and add a where condition to query but i think it is not a solution when i changed the page i'd be still see the cars,

i want do it with shared components, i can do 2 shared components or use 2 query in page item (select list) but i donot wanna make like this. is there a way to do it in shared component?


Solution

  • To me, it is

    • a single page (e.g. interactive report)

    • one page select list item, P1_TYPE

    • page source is

      select * from table_vehicles
      where type = :P1_TYPE or :P1_TYPE is null
      

      which - by default - shows all rows when P1_TYPE is empty

    • P1_TYPE's query should reference table of all available types, e.g.

      select name as display_value,
             type as return_value
      from vehicle_types
      
    • set item to submit the page once value is selected

      • alternatively, create a button (its label might be "Display") which then submits page or redirects and sets value
    • when you run the page and modify P1_TYPE, submitting the page will refresh interactive report and display only selected type of vehicles