Problem saving master/detail
-
- Posts: 4
- Joined: Thu 06 Oct 2011 06:08
- Contact:
Problem saving master/detail
Hi and tx for any answer.
using VT 8 I have a master table and a detail table. At runtime I add date to both tables, this works ok, as my grids only show thje detail records. However, when I want to save the data to a file via SaveToFile only the detail records for the active rec are saved.
What am I missing?
tx Bernd
using VT 8 I have a master table and a detail table. At runtime I add date to both tables, this works ok, as my grids only show thje detail records. However, when I want to save the data to a file via SaveToFile only the detail records for the active rec are saved.
What am I missing?
tx Bernd
-
- Posts: 4
- Joined: Thu 06 Oct 2011 06:08
- Contact:
Hello,
The next build will be available next week. For the time being you can fix this problem by making the following changes in the MemDS.pas file:
add the following code to the TMemDataSet.MDPropertiesChanged method:
The next build will be available next week. For the time being you can fix this problem by making the following changes in the MemDS.pas file:
add the following code to the TMemDataSet.MDPropertiesChanged method:
Code: Select all
if Data nil then
Data.FilterUpdated;
if Active then
Resync([]);
-
- Posts: 4
- Joined: Thu 06 Oct 2011 06:08
- Contact:
No, this does not fix the problem.
vt2 still only holds data for one record from vt1
Code: Select all
vt1.SaveToFile('vt1.vtd',true);
vt2.SaveToFile('vt2.vtd',true);
vt1.close;
vt2.close;
vt1.open;
vt2.open;
vt1.LoadFromFile('vt1.vtd',true);
vt2.LoadFromFile('vt2.vtd',true);
Hello,
The SaveToFile method saves data that is in DataSet at the moment, and as Detail DataSet contains only records that correspond to the current record in Master Dataset. You need to set the MasterSource property to nil beforehand in order to save all your records:
var
TempDataSource: TDataSource;
begin
TempDataSource:= DetailVirtualTable.MasterSource;
DetailVirtualTable.MasterSource:= nil;
DetailVirtualTable.SaveToFile('d:\1.bak');
DetailVirtualTable.MasterSource:= TempDataSource;
The SaveToFile method saves data that is in DataSet at the moment, and as Detail DataSet contains only records that correspond to the current record in Master Dataset. You need to set the MasterSource property to nil beforehand in order to save all your records:
var
TempDataSource: TDataSource;
begin
TempDataSource:= DetailVirtualTable.MasterSource;
DetailVirtualTable.MasterSource:= nil;
DetailVirtualTable.SaveToFile('d:\1.bak');
DetailVirtualTable.MasterSource:= TempDataSource;
-
- Posts: 4
- Joined: Thu 06 Oct 2011 06:08
- Contact: