I've been looking the answer for a while now, but couldn't find solution to my problem. It's a rather insignificant issue, but after dealing with more pressing problems I stuck with this one and I cannot move forward I am using Apex 4.2.1.
Ok, lets start with a description.
I have two select lists. After making a choice in the first one I would like the second one value to change. It's not cascading LOV case however, at least I don't think so.
Let me give you an example. Suppose we have a table with name and default occupation.
End user firstly chooses name from the first list and then the occupation from another. It may be not clear from the given example, but the order matters.
What I want is to force a change in second list value after a choice in the first one is made. So after the name is picked, the occupation should change to the default one.
The assignment is the most typical one, but not the only one. Therefore I want the end user to be able to change the occupation if needed. Meaning Tom does not have to be janiotor, he can be whoever he wants That's why it's not the cascading LOV problem.
I've tried with dynamic actions - setting the value and then refresh. It works when the second select list is text field. I cannot find the way to make it work with another select list.
Hope you can help.
I do not refer to the return or display value explicitly. However inspired by your answer I begun to test a bit more, and completely by accident I found something that works. It's not an optimal way though, but maybe this will give you any hint for a more neat way.
Ok, I have two items, lets say 1st_name_list and 2nd_occupation_item.
When the 2nd_occupation_item is a text filed, then I have a dynamic action attached to the 1st_name_list item (on change). It consists of two true actions:
1. Set value, SQL Statement type
"select default_occupation from my_table
where name = :1st_name_list"
2. Refresh: refresh 2nd_occupation_item
The default value of 2nd_occupation_item is left blank (static text type). Everything works fine.
When I change the 2nd_occupation_item into the select list there's no refresh. Or the refresh happens (you can see select list reloading), but the value remains unchanged.
The detour is to add the default value as PL/SQL Expression for 2nd_occupation_item, in the way:
"case when :2nd_occupation_item = 'John' then 'Doctor'
when :2nd_occupation_item = 'tom' then 'Janitor'
else 'Fireman' end"
Now the refresh works. The problem is that writing the whole case clause is not as convinient as using the select statement, especially with many default categories.
What's more, I cannot remove the set value action. Without it the refresh will not work.
Do you have any ideas?
What I meant with display and return value, you usually have a Select list query like this:
SELECT occupation d, occp_id r
So your return value is an ID. To use text as a return value is rather uncommon. Hence my question, because obviously you need to Select the return value in your query, NOT the display value.
At that time your select list still has the OLD value in the session. You then do a refresh and the item uses the old value, and it looks like nothing happens.
- clear the default values, you don't need those
- get rid of the refresh in your DA
I know it's uncommon, and in most cases in my application the return value is numeric (ID). But in this case the display and return values are the same.
The select statement is the same for the text field and the select list.
In the case of text field it works without the default values, refresh is needed though. (by it I mean that the change in the first select list results in a change in the other item - in this case the text field).
With select list it does not work without the default values, which I cannot grasp.
I've requested the workspace, prepared an example... and it worked the way you sai!d I just didn't include the refresh action.
After careful examination of the previously described case it began to work as well. Unfortunately I'm unable to finde the very first mistake that I had made (after so many corrections it's impossible), but you showed me the right direction Many thanks