Page 1 of 1

Master / Detail

Posted: Mon 24 Jan 2011 13:43
by PerW
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

Posted: Wed 26 Jan 2011 11:48
by AndreyZ
Hello,

I cannot reproduce the problem. Please describe in details how you established the master/detail relationship.

Posted: Mon 14 Feb 2011 13:10
by Lithiumâ„¢
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?

Posted: Wed 16 Feb 2011 14:08
by AndreyZ
I cannot reproduce the problem. Please try composing a small sample to demonstrate the problem and send it to andreyz*devart*com, including a script to create and fill tables.

Posted: Wed 02 Nov 2011 11:57
by juanmaria
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

Posted: Wed 02 Nov 2011 13:21
by 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;

Posted: Wed 02 Nov 2011 15:26
by juanmaria
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;
Thank you, it worked like a charm!

Posted: Wed 02 Nov 2011 15:35
by AndreyZ
Feel free to contact us if you have any other questions about SDAC.