Home » Developer & Programmer » Forms » Master-Detail
Master-Detail [message #124916] Wed, 22 June 2005 06:01 Go to next message
vinu.m@naizak.com
Messages: 6
Registered: June 2005
Junior Member
/forum/fa/250/0/Hi everybody,<br />
<br />
I am facing problem in a complex master - detail . I have 4 Datablocks. <br />
 <br />
A     PL_T_MAINTENANCE_HD<br />
B     PL_T_MAINTENANCE_DET<br />
C     PL_T_MAINTENANCE_TECNI_DET<br />
D     PL_T_MAINTENANCE_MATERIAL_DET<br />
 <br />
B is having one to many relation with A , C and D is having one to many relation with B . Against a work order, there are many tasks. Against one Task there are many technicians and many materials. Once i filled a task in B and went to C to enter the technicians and to D to enter materials. After the entry of technicians and materials, i will click on the block B to enter next task. At this time form is asking me whether i need to save the record, if i clicked Yes, it will save and clear the form. I don't want this, i need to be saved at the end ..... i tried POST in the when new block instance on the block B but it is saving all the form and causing the primary key failure error since the Work Order Number will be generated as a part of the commit process. <br />
<br />
<br />
<br />
Can any of the friends give me a solution for this.<br />
<br />
Thanks in advance<br />
Regards <br />
Vinu
  • Attachment: WO2.JPG
    (Size: 96.13KB, Downloaded 901 times)
Re: Master-Detail [message #125040 is a reply to message #124916] Wed, 22 June 2005 18:52 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Okay .. nice picture ... how can we help you with it?

David
Re: Master-Detail [message #125060 is a reply to message #125040] Thu, 23 June 2005 01:40 Go to previous messageGo to next message
vinu.m@naizak.com
Messages: 6
Registered: June 2005
Junior Member
sorry david, actually i typed the matter also. i dont know where is the matter. I will explain again...

I have a very serious issue ... pls help me ...
The problem is i have 4 Datablocks.

A PL_T_MAINTENANCE_HD
B PL_T_MAINTENANCE_DET
C PL_T_MAINTENANCE_TECNI_DET
D PL_T_MAINTENANCE_MATERIAL_DET

B is having one to many relation with A
C and D is having one to many relation with B . Against a work order, there are many tasks. Against one Task there are many technicians and many materials. Once i filled a task in B and went to C to enter the technicians and to D to enter materials. After the entry of technicians and materials, i will click on the block B to enter next task. At this time form is asking me whether i need to save the record, if i clicked Yes, it will save and clear the form. I don't want this, i need to be saved at the end ..... i tried POST in the when new block instance on the block B but it is saving all the form and causing the primary key failure error since the Work Order Number will be generated as a part of the commit process.

I tried the POST ... for that the work_order_no is one among the primary key and this number will be generated only at time of saving. Without this work_order_no, "post" is generating error.

I would like to have some work arround for this issue

thanks in advance
Vinu
Re: Master-Detail [message #125066 is a reply to message #125060] Thu, 23 June 2005 02:06 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Okay ...

A PL_T_MAINTENANCE_HD = Work Order
B PL_T_MAINTENANCE_DET = Task
C PL_T_MAINTENANCE_TECNI_DET = Technician
D PL_T_MAINTENANCE_MATERIAL_DET = Material


I want to know the primary keys for each of these tables.

You will have 'relations' defined between A&B, and B&C and B&D. These have to have the data to store the lower level records as you go to the next Task.

Are you trying to reuse the Technician and Material records for different Tasks, or is PL_T_MAINTENANCE_TECNI_DET a cross-reference table between Task and the Unique Technician table.

Okay ... I need you to supply the first few columns of each table and answer the question about 'reuse'.

David
Re: Master-Detail [message #125076 is a reply to message #125066] Thu, 23 June 2005 03:04 Go to previous messageGo to next message
vinu.m@naizak.com
Messages: 6
Registered: June 2005
Junior Member
hi martin

A PL_T_MAINTENANCE_HD = Work Order
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Primary Keys are : V_WORK_ORDER_NO and N_CO_CODE


B PL_T_MAINTENANCE_DET = Task
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Primary Keys are : V_WORK_ORDER_NO, V_TASK_CODE and N_CO_CODE

C PL_T_MAINTENANCE_TECNI_DET = Technician
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Primary Keys are : V_WORK_ORDER_NO, V_TASK_CODE, V_EMPI_IDNO and N_CO_CODE

D PL_T_MAINTENANCE_MATERIAL_DET = Material
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Primary Keys are : V_WORK_ORDER_NO, V_TASK_CODE, V_ITEM_CODE and N_CO_CODE

These are the Primary Keys for the four tables. Am not "reusing" the technicians and materials for another tasks. It will be entered again if they required.


Some Important Columns from each table
A PL_T_MAINTENANCE_HD = Work Order
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
V_WORK_ORDER_NO VARCHAR2(12 BYTE),
D_WORK_ORDER_DATE DATE,
V_DOC_AGAINST CHAR(1 BYTE),
V_REQ_NO VARCHAR2(12 BYTE),
V_ASSET_NO VARCHAR2(20 BYTE),
V_ASSET_DESC VARCHAR2(200 BYTE)
....
....


B PL_T_MAINTENANCE_DET = Task
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
V_WORK_ORDER_NO VARCHAR2(12 BYTE),
V_TASK_CODE VARCHAR2(7 BYTE),
V_TASK_DETAIL VARCHAR2(3000 BYTE),
D_SCH_DATE DATE
...
...


C PL_T_MAINTENANCE_TECNI_DET = Technician
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
V_WORK_ORDER_NO VARCHAR2(12 BYTE) NOT NULL,
V_TASK_CODE VARCHAR2(7 BYTE) NOT NULL,
V_EMPI_IDNO VARCHAR2(10 BYTE) NOT NULL,
N_MANPOWER_COST NUMBER(7,2)
...
...

D PL_T_MAINTENANCE_MATERIAL_DET = Material
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
V_WORK_ORDER_NO VARCHAR2(12 BYTE) NOT NULL,
V_TASK_CODE VARCHAR2(7 BYTE) NOT NULL,
V_ITEM_CODE VARCHAR2(20 BYTE) NOT NULL,
N_QTY NUMBER(10,3),
...
...




I hope i cleared ur doubts

Cheers !!!
Vinu
Re: Master-Detail [message #125083 is a reply to message #125076] Thu, 23 June 2005 03:36 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
I would prefer it if you didn't re-enter the technician and material details this way, but that is a philosophical point.

Try this. For blocks A and C create a When-Create-Record trigger and populate the respective ID for that table from the sequences that you have defined. That is,
for table A populate V_WORK_ORDER_NO, and
for table C populate V_EMPI_IDNO.

Then delete the 'relations' between the tables and use the wizard to recreate them. You should end up with code that automatically populates the corresponding keys fields for you.

If this doesn't work, then you may have to manually set the 'Copy Value from Item' (CVfI) of the lower level fields from the higher level block's field of the same name. That is, B.V_WORK_ORDER_NO has a 'CVfI' of A.V_WORK_ORDER_NO,
C.V_WORK_ORDER_NO <= A.V_WORK_ORDER_NO and C.V_TASK_CODE <= B.V_TASK_CODE,
etc.

Try it and see how you go.

David
Re: Master-Detail [message #125089 is a reply to message #125083] Thu, 23 June 2005 04:28 Go to previous messageGo to next message
vinu.m@naizak.com
Messages: 6
Registered: June 2005
Junior Member
David,
thanks for the info.. But am thinking that we are moving apart from my concern. My problem is once i entered the technicians and materials in block C and D against a task in block B and adding the next row in block B form is prompting me to save the records, which i dont want. I must be able to enter the C and D again for another task. The V_WORK_ORDER_NO is a system generated value and i would like to generate that number only at time of saving


vinu
Re: Master-Detail [message #125223 is a reply to message #125089] Thu, 23 June 2005 19:51 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
V_EMPI_IDNO is also automatically generated, isn't it?

Okay ... how about trying it my way ... it is doesn't work, tell me ... if it does work, then you can decompose it back to your intention.

A Master-Detail relationship needs to have data for the primary key fields (its in a book somewhere).

The worst solution, which I detest and your have said you don't want, is at each block to test the RECORD_STATUS and if it is CHANGED or NEW, do a COMMIT.

David

[Updated on: Thu, 23 June 2005 19:52]

Report message to a moderator

Previous Topic: "Could not reserve record" message
Next Topic: to display user defined error when entering duplicate values
Goto Forum:
  


Current Time: Thu Sep 19 23:25:10 CDT 2024