Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

coordinating data blocks on tab pages

Status
Not open for further replies.

bookouri

IS-IT--Management
Feb 23, 2000
1,464
0
0
US
Can someone tell me the "correct" way to coordinate master/detail records on data blocks on two tab pages. For example, employee block on tab page 1, employee addresses block on tab page 2. I add a new employee and save/commit, my table trigger populates the emp_id using a sequence, then I click on the address tab page where I have multiple rows displayed tabular, I click on an empty row and type in the data for the address record... what mechanism is best to use to populate the emp_id in the address block? A block level trigger? a trigger on a table item? Ive done it with an item trigger such as POST CHANGE on one of the table items..but is this the "correct" way to do it?

any suggestions would be appreciated
 
Have you created your form as master-detail? I mean relation between blocks. If so, you need not worry about seting child key at all, as Forms does it for you. In fact it uses COPY FROM property and copies parent key during commit processing.

Regards, Dima
 
I thought that was the case, but I ran into a situation where it didnt work and I couldnt get it to work, so I wondered if I was missing something. The situation I found was that if I added a record to the master block, did a save, then left that record and later went back to it, everything worked fine. However, if I added the master record, saved it, and then went immediately to the tab of the child block and added child records, then did a save of the child records, the child records were saved to the table, but upon checking the table, I found that the primary key value from the master table was not being saved with the child records.

Just for clarification, when you create the data blocks, using the data block wizard, do you create the relationship on BOTH data blocks? or only on the Master or only on the Child block? do you check the enforce relationship box on each? one or the other?

thanks again for all the help...
 
The relationship is only required on the Master. Such as, employees.emp_id = addresses.emp_id. With regards to enforce relationship, I prefer to create my own.

Regards

rypper
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top