The Master part is a plain standard form and below on the same page there is a tabular form containing the details.
Did you use the Master-Detail Form wizard? Or did you build it manually?
I've tried all kind of stuff like fill in the default value for the (master) primary key etc, but the field is still not filled at the time of submit.
Filled into what ? Did you try filling the PK of Master into the columns in Detail? A code snippet used would be useful here.
Processes are :
1. Automatic row proces of the master record ( I've filled in the "Return Key Into Item" field with the masters primary key )
2. ApplyMRU for the detail records.
Try writing a process with a sequence between the above 2 processes that populates the array in Detail. Assuming f01 is your Detail column that must be updated with the PK of master the code will look like
FOR I IN APEX_APPLICATION.G_F01.COUNT LOOP APEX_APPLICATION.G_F01(I) := <Return Key Into Item of Master> ; -- REPLACE PLACEHOLDER WITH ITEM NAME USING BIND VAR SYNTAX (:) END LOOP;
Thx, problem solved :)
Not sure if I build it manually or generated it but the problem always exists for standard master detail forms.
I'm using a sequence to generate the primary key ( trigger ). I think the problem is that the primary key is not available at the time you enter the detail records and afterwards in the process fase it's not automatically populated to the FK field.
The suggested PL/SQL process fixes this so problem solved.
make sure you update the correct array in the PL/SQL process.
Also make sure that the "process row" process of the master ( which does the insert ) runs before the PL/SQL process and that in the properties of the "process row" process the field "return key into item" is filled with the primary key field of the master.
So steps should be :
1. Insert the master row and in this process return the inserted primary key back into the primary key field on your form
2. Update the foreign key field of all child records with the newly gererated primary key of the master ( this is done in the PL/SQL process ).