Kokapellie
Kokapellie

Reputation: 27

Oracle Apex dynamic action PL/SQL that will change the values in a select list based on a value passed by another field

So i have a Table Called "Fruit" this table is manually upload with what kind of Fruit the users like. But we know that we have different colored "Fruit" these colors are not on the table.

So i have created a form for the user and want to create a dynamic select list based on the "Fruit"

Form:

Name: Bob

Age: 45

Fruit: Apple

What color:(Select List based of Fruit) Red,Green,white

Now i have 12 fruit option on the table and maybe six color i want to use, but i do not want all the colors displayed.

So if the "Fruit" column (based on table) was apple only show Red,Green,white in the select list

if the "Fruit" column (based on table) was banana only show Yellow,Green,Brown in the select list

if the "Fruit" column (based on table) was grape only show Red,Green in the select list.

Upvotes: 0

Views: 1613

Answers (1)

Tony Andrews
Tony Andrews

Reputation: 132710

APEX can do this quite easily. Define the query for the colors so that it only shows the colors appropriate for the fruit item selected. Something like:

select c.color_name, c.color_code
  from colors c
       join fruit_colors fc on fc.color_code = c.color_code
 where fc.fruit_code = :P123_FRUIT_CODE;

(Here P123_FRUIT_CODE is the name of your fruit select list item).

Then set the Cascading LOV Parent Item(s) property of the colors LOV to P123_FRUIT_CODE.

Now, whenever the user changes P123_FRUIT_CODE by selecting a fruit, the colors LOV will be updated to show only the colors available for that fruit.

Upvotes: 2

Related Questions