I am trying to do an auto population of a form text-field in APEX using another database table as follows:
Table 1: TSTPAY
(FORM Write)
ID (Sequence)
EMP_ID
BU_ID
AMOUNT
Table 2: EMBU
EMP | A
BU | BU_A
Basically I am looking for the APEX form to behave in such a way that when the user inputs 'A' into the the EMP_ID text field, it will trigger an action to pre-populate the BU_ID to BU_A.
The action I've created does not appear to be resolving any value for :P7_EMPID. I can see the action working where I've hard coded in the 'Where' value into my SQL statement (i.e. SELECT BU FROM BUEMP A WHERE A.EMP = 'A'
)
Any advice would be greatly appreciated!
Full implementation details below:
Using some resources I've built a dynamic action to trigger on change of the P7_EMPID. -Sequence:10 -When Event: Change, Selection type items: P7_EMPID, EVENT SCOPE STATIC
SET VALUE -Action: set value, set type: SQL statement, page items to submit: P7_BU, escape special characters: no, supress change event: no, affected elements: items, affected element item: P7_BU, fire when event result is true, fire on page load: true, wait for result: true.
The SQL query used is:
SELECT A.BU
FROM BUEMP A
WHERE A.EMP = :P7_EMPID