This discussion is archived
6 Replies Latest reply: Apr 11, 2013 2:19 AM by uzairmalik RSS

Master-Detail Form in Form6i Developer

uzairmalik Newbie
Currently Being Moderated
First of All Hi to all Respected Gurus.

I am stuck in a very basic element and that is Primary-Key/Foreign-Key relation. I am trying to create a Master-Detail Form based on following structure. Records in Master Table and Child Table are saving (inserting) but Primary Key of Master Table is not saving (inserting) as "Foreign Key" in Detail Table.

--------------------------------------------------
Here is Table Structure(s)
-------------------------------------------------

Master Table Name : MGTC_EDM

CREATE TABLE MGTC_EDM
(
EDM_ID NUMBER, -- PRIMARY KEY
BILLING_DATE DATE,
CONSTRAINT PK_MGTCEDM_EDMID PRIMARY KEY (EDM_ID)
);

*************************************************************
CHILD TABLE : MGTC_EDD
CREATE TABLE MGTC_EDD
(
EDD_ID NUMBER; -- PRIMARY KEY
EDM_ID NUMBER; -- FOREIGN KEY RELATION WITH MGTC_EDM
MEM_ID NUMBER;
AMOUNT NUMBER;
CONSTRAINT PK_MGTCEDD_EDDID PRIMARY KEY (EDD_ID),
CONSTRAINT FK_MGTCEDD_EDMID FOREIGN KEY (EDM_ID)
REFERENCES MGTC_EDM (EDM_ID)
);

*****************************************************************************************
TRIGGER OF "BEFORE_INSERT" IS APPLIED ON BOTH TABLES TO AUTO-POPULATE INCREMENTAL ID

*****************************************************************************************

IN FORM6I, I'VE APPLIED A 'KEY_NEXT_ITEM' TRIGGER ON BILLING_DATE FIELD OF MASTER TABLE TO COMMIT THE RECORD AND TO MOVE THE CURSOR TOWARDS DETAIL BLOCK

AND THERE ARE NO MORE TRIGGERS IN THE FORM.

AS CURSOR MOVES TOWARDS DETAIL BLOCK, RECORD IN MASTER TABLE SAVES (COMMITTED) ON AUTO AND WHEN I PRESS "SAVE" BUTTON TO SAVE THE RECORD IN CHILD FORM DETAIL TABLE ALSO COMMITTED

BUT WHEN I PRESS F8 TO EXECUTE THE QUERY ONLY MASTER RECORD SHOWS AND NO RECORD SHOWS IN THE DETAIL TABLE. WHEN I CHECKED IN DETAIL TABLE IN TOAD, IT FOUND THAT PRIMARY KEY OF MASTER TABLE (EDM_ID) NOT SAVED IN DETAIL TABLE.


PLEASE HELP.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points