Search code examples
oracle-apexoracle-apex-5

How to change a selectedlist item based on other item?


I am using APEX to develop an insert page for my interactive report. There are two select list items "product" and "version". If the user choose one product then the list for version should be changed based on it. Currently, I've created a dynamic action and set the event to "select". If the event is true, I set the action to "set value", and set type to "sql statement". But it doesn't work. My sql code is below.

select v.NAME, v.ID from version v
where v.PARENT_ID = :P3_PRODUCT_ID
order by upper(v.NAME) asc;

One thing also needs to be consider: product id and version id are stored in the table "report" for interactive report. But I want to show product name and version name on the insert page, so I query from table "version".


Solution

  • Discard your dynamic action, on your P3_VERSION list definition, set the value on the field "Cascading LOV Parent Item(s)" to: P3_PRODUCT_ID, this will cause a refresh to the P3_VERSION item each time that the P3_PRODUCT_ID item value changes.

    If you want to keep your dynamic action though, you should set the firing condition to a value change on P3_PRODUCT_ID and make a refresh on the P3_VERSION item instead of a Set Value.