Master / Detail
Master / Detail
Hi
I try make master detail with last version 5.00.03. On insert master id is not filled in before detail field is sent to sql server.
In DBMonitor I get this for Master insert:
SET ? = SCOPE_IDENTITY()
The Master field get new ID from server ,so it is the Detail key field that must be updated with Scope_Identity from master. Where do I set this.
I have set LocalMasterDetail = true for Detail.
Regards Per
I try make master detail with last version 5.00.03. On insert master id is not filled in before detail field is sent to sql server.
In DBMonitor I get this for Master insert:
SET ? = SCOPE_IDENTITY()
The Master field get new ID from server ,so it is the Detail key field that must be updated with Scope_Identity from master. Where do I set this.
I have set LocalMasterDetail = true for Detail.
Regards Per
-
AndreyZ
New problem under this subject.
Detail TMSQuery doesn't display anything when program runs under Windows7. This problem is unstable and only few machines doesn't work properly (units from hundreds). Under WindowsXP all machines work properly.
To solve this problem I replace Master/Detail ability with AfterScroll event handler on master-side which sent parameter to detail dataset. It's little uncomfortable to lose functionality and "downgrade" code of my program, isn't it?
What is the reason of this problem?
Detail TMSQuery doesn't display anything when program runs under Windows7. This problem is unstable and only few machines doesn't work properly (units from hundreds). Under WindowsXP all machines work properly.
To solve this problem I replace Master/Detail ability with AfterScroll event handler on master-side which sent parameter to detail dataset. It's little uncomfortable to lose functionality and "downgrade" code of my program, isn't it?
What is the reason of this problem?
-
AndreyZ
Hi,
I've just upgraded from SDAC 3 to 6 and I'm finding this very problem.
With SDAC 3 when I chaged the value of the master field on a table the detail table was updated inmediatly, now it seems that it is not updated at that moment.
When I scroll the master table it works fine, is when I change the value of a master field when it does not update.
I'm going to write some code on the onDataChange event of the DataSource to make a quick fix but a good solution would be desirable.
Right now I cannot make a sample and the program I'm working now is too huge but the thing is as follows:
TABLE A: MASTER
FIELDA1
FIELDA2
FIELDA3
TABLE B: DETAIL
FIELDB1
FIELDB2
FIELDB3
RELATION
FIELDB1 -> FIELDA1
In version 3 I did, for example:
TABLEA.edit;
TABLEAFIELDA1.Value := 'Something';
[and instantly TABLEB reflected the appropriate change]
Right now TABLEB has all its fields as null
I've just upgraded from SDAC 3 to 6 and I'm finding this very problem.
With SDAC 3 when I chaged the value of the master field on a table the detail table was updated inmediatly, now it seems that it is not updated at that moment.
When I scroll the master table it works fine, is when I change the value of a master field when it does not update.
I'm going to write some code on the onDataChange event of the DataSource to make a quick fix but a good solution would be desirable.
Right now I cannot make a sample and the program I'm working now is too huge but the thing is as follows:
TABLE A: MASTER
FIELDA1
FIELDA2
FIELDA3
TABLE B: DETAIL
FIELDB1
FIELDB2
FIELDB3
RELATION
FIELDB1 -> FIELDA1
In version 3 I did, for example:
TABLEA.edit;
TABLEAFIELDA1.Value := 'Something';
[and instantly TABLEB reflected the appropriate change]
Right now TABLEB has all its fields as null
-
AndreyZ
Starting with SDAC 4.50.0.36, when master/detail relationship is used on inserting a new record into master table parameters in detail table are not updated. To restore the old behavior, set the RefreshParamsOnInsert global variable (that is declared in the MemDS unit) to True. For this, you should use the following code in one of the units of your application:
Code: Select all
initialization
RefreshParamsOnInsert := True;Thank you, it worked like a charm!AndreyZ wrote:Starting with SDAC 4.50.0.36, when master/detail relationship is used on inserting a new record into master table parameters in detail table are not updated. To restore the old behavior, set the RefreshParamsOnInsert global variable (that is declared in the MemDS unit) to True. For this, you should use the following code in one of the units of your application:Code: Select all
initialization RefreshParamsOnInsert := True;