I'm using APEX 4.1, oracle 11g
I have an application where we can create new patients.
On the create page, i have a text box that the end user can enter the patiend id to get the patients information.
The id number goes to a table to get first name, last name, dob etc then fills out the items on the page.
From there the end user has the option to add comments about a patient, then click CREATE to create the record.
The problem i'm having is, the fields that are populated from a dynamic action are not being inserted into the table, when they click create.
I'm using dynamic actions to populate certain fields for a patient.
I use an EXECUTE PL/SQL CODE to set the items.
select pat_id, first_nm ,last_nm,dob)
where pat_id = :P2_PAT_ID_SEARCH;
For PAGE ITEMS TO SUBMIT: i use P2_PAT_ID_SEARCH
For PAGE ITEMS TO RETURN i use: P2_PAT_ID,P2_FIRST_NM,P2_LAST_NAME,P2_DOB
When i run the search and find a patient, it populates the fields correctly.
When i look at the items in the session, the values are correct for the page-items and session state.
But when i create the record, i these fields are blank.
The page items were item type DISPLAY ONLY
I changed them to TEXT-FIELDS but disabled, and that didnt work.
If i change them to TEXT-FIELDS and leave them editable it works.
But i don't want the end user to edit these fields, i want the data to come from our demographics table.
Any ideas on what could be causing this issue?
What is the Process when the "Create" button is clicked?
I usually call a procedure that adds records.
code_schema.my_app_api.addComment( :P2_PAT_ID, :P2_COMMENTS );
Since the end-user is not allowed to edit demographics information, you don't need to send that.
The procedure will re-fetch all that information, most likely, as part of an 'INSERT ... SELECT' statement.
In your dynamic action, add an exception "when no_data_found" clause to clear out the values... (and set ID to NOT FOUND)
EXCEPTION WHEN no_data_found THEN P2_PAT_ID := 'Pat ID not found'; -- I'm sure there is a cheat for this. P2_FIRST_NM := NULL; P2_LAST_NM := NULL; P2_DOB := NULL; END;
When the create button is clicked it uses the DML process to insert the record. I don't have a procedure to do the insert.
Additionally i want to show(display) the end user the patient demographics before they create the record.
And the only thing i really want to send or submit is the patient id which is displayed.