The following very simple example shows 3 uses:
1) Enabling/disabling one field according to the value of another
2) Calculating and displaying a value when items are updated
3) Retrieving information from the database when an item is changed.
There is little documentation about Dynamic Actions yet, so I'm not sure I have always taken the best approach.
My example is a "Create Employee" page that inserts a row into the familiar EMP table:
I have created a Dynamic Action that makes the Commission item enabled only when the selected job is one of 'MANAGER' or 'SALESMAN'.
These are "simple" actions, I merely had to specify which item values trigger the action like this:
... and then specify the item to be enabled/disabled.
Another dynamic action computes the "Total Package" as SAL+COMM when either of these two items are updated:
A third dynamic action fires when a manager is selected; this looks up the selected employee and gets his/her job title and department name and dislays them in 2 page items:
This last action isn't as efficient as I'd like because it results in 2 AJAX calls: one to get the job and one to get the department name. This could be a case of me just not knowing the right way to do it in one hit. I used 2 "true actions" that use SQL to set the value of an item. The first has this SQL:
select job from emp where empno = :p2_mgr
and the second:
from dept join emp using (deptno)
where empno = :p2_mgr