Master-detail relationship on 2 tabs : coordination problem [message #299523] |
Tue, 12 February 2008 05:38  |
wyatt
Messages: 4 Registered: February 2008
|
Junior Member |
|
|
Hello all !
I have two tabs.
The first contains the master block.
The second contains the details block (multi-rows).
The master-detail relationship has been created with the wizzard.
When i browse the master records in the first tab, the details records populate accordingly in the second tab, so it works well.
My issue is : when i add a new record in the master block (with CREATE_RECORD), save it (with COMMIT_FORM) and click on the second tab to insert detail records, i see that the detail block is not correctly refreshed : it is empty except of one record and one field (the foreign key) wich still contain an old value. When i click on this field, the value is replaced by the good one (the primary key of the master record).
No big issue but i think it is confusing for the user to see the value 'A' in the detail block whereas he just added the record 'B' in the master block.
Note : if after the COMMIT_FORM i do a GO_BLOCK('detail'), then the detail block is correctly refreshed. But i don't want to go to this block just after the commit. It is the user who decides to go to this block by clicking on the second tab. And data must be correctly refreshed at that time.
[Updated on: Tue, 12 February 2008 05:39] Report message to a moderator
|
|
|
|
|
Re: Master-detail relationship on 2 tabs : coordination problem [message #299745 is a reply to message #299523] |
Wed, 13 February 2008 01:43   |
wyatt
Messages: 4 Registered: February 2008
|
Junior Member |
|
|
First, thank you for your replies 
vamsi kasina wrote on Tue, 12 February 2008 17:00 | You can use a When-Tab-Page-Changed trigger to go to the first item in the detail block. You may need to check the tab page name to do so.
|
Yes i had this idea too and it will work. But... shouldn't Forms handle this itself ?
djmartin wrote on Wed, 13 February 2008 06:48 | Why do you have a 'create_record' on the 'master' block? What is wrong with the default logic? The 'create_record' should be on the 'detail' block.
|
In the first tab, which contains the 'master' block, i placed a "+" button, which triggers a CREATE_RECORD, so the user can insert a record.
The user can also go to the "last record + 1" to insert a new record, but this doesn't change anything to the "problem".
When the user is okay with its 'master' records, then he go to the second tab which contains the 'detail' block, to insert the 'detail' records. And there will be indeed another "+" button with CREATE_RECORD.
I wish to keep it as simple and native as possible, as often advised here. What is the default logic you mentioned ?
Thanks again !
|
|
|
|
Re: Master-detail relationship on 2 tabs : coordination problem [message #300179 is a reply to message #299950] |
Thu, 14 February 2008 08:52   |
wyatt
Messages: 4 Registered: February 2008
|
Junior Member |
|
|
Perhaps i missed something, but what do i have to write in this 'When-Create_Record' trigger ?
I created it anyway, with a simple MESSAGE() coded inside just to test it. Unfortunately, it is not triggered when navigating from the 'master' block to the 'detail block' in the other tab.
Note that when pressing the "+" button (CREATE_RECORD) in the 'detail' block, it populates the block with the right key value.
It's not a very big issue (mainly a refreshing problem i think), but i would just like to understand. Thanks for your help and patience !
|
|
|
|
Re: Master-detail relationship on 2 tabs : coordination problem [message #301081 is a reply to message #300713] |
Tue, 19 February 2008 02:56   |
wyatt
Messages: 4 Registered: February 2008
|
Junior Member |
|
|
Well, both "+" buttons just do a CREATE_RECORD on their respective block.
WHEN-TAB-PAGE-CHANGED and MESSAGE(:SYSTEM.CURSOR_BLOCK) show me that the navigation stays on the 'master' block, even if i switch between tabs.
When i just click on the 'detail' block, it refreshes correctly.
Navigating to the detail block with a GO_BLOCK in the WHEN-TAB-PAGE-CHANGED is the only solution i see so far.
|
|
|
|