Page 1 of 1
Cached master-detail and insertions
Posted: Wed 23 Jun 2010 13:40
by Lithium™
Is there way to insert some records into master-dataset, then insert some records into detail-dataset for each master-record, then navigate and modify all inserted records, afterwards apply updates for both master and detail MSQueries? (I was understandable expressed?)
To reach desired effect I perform plenty of monotonous handmade for each pair of master-detail in my application. A huge problem could become solved if way exists.
Posted: Thu 24 Jun 2010 08:06
by Dimon
When establishing master-detail relationship the CachedUpdates property of detail dataset works properly only when TCustomDADataSet.Options.LocalMasterDetail is set to True.
You can find more detailed information about this in the SDAC help.
Posted: Thu 24 Jun 2010 12:49
by Lithium™
Thank you for response. I try this option before post began and unfortunately desired effect is not reached.
I explain more detailed. Inserted but not applied master-records has a no values for fields, which values fixed on server side (identity fields, fields with defvalues and the like). I need to set the MasterFields property of a detail-dataset exactly for such fields. In result the master-field has NULL value for all insertions and can not be used for my needs.
Posted: Thu 24 Jun 2010 15:07
by Dimon
1. You should set the TCustomDADataSet.Options.LocalMasterDetail property to True before dataset opening.
2. If you use fields with default values, to solve the problem, you should set the TCustomMSDataSet.Options.DefaultValues property to True. But if you use identity fields for master/detail relationship, you can not use the CachedUpdates mode.
Posted: Fri 25 Jun 2010 08:25
by Lithium™
Thanks, I has missed the TCustomMSDataSet.Options.DefaultValues property, this became useful in some cases.
It's highly comfortable to use identity fields for master-detail relationships (in my application) and keep all datasets in Cached mode. I tried to find any way to do it. TCustomMSDataSet does not give such possibility, I suspected in general that (it not complaint to Devart).
Not it is necessary to talk that the way indeed exists. As variant to generate and store internal value for such fields and relate details (on client side) by this value, after update this values must be replaced with real values.
Are you plan to add such functionality for SDAC in future conceptually?
Posted: Tue 29 Jun 2010 09:27
by Dimon
We don't plan to implement such functionality, because it is very specific. You can implement it yourself in your application.
Posted: Wed 30 Jun 2010 05:46
by Lithium™
I can't argue about specificity (may be other forum visitors can say anything about

), however thank you for argued answer.