Problems with Master / Detail relations
Dear Mr, Mrs,
I've got a strange problem. If there are no detail records, my masterfields
will not show. When there is a detail record (or more) then it's all
displayed correctly. Since I create the components in my sourcecode, I will
give you a example.
Detail table:
aTable := TCRepTable(DmMain.Components[i]);
aTable.MasterSource := TDataSource(DmMain.FindComponent('ds'
+
FrmReports.tblReportTool.FieldByName('Pri_File').AsString));
aTable.IndexFieldNames:=
FrmReports.tblReportTool.FieldByName('Sec_Key').AsString;
aTable.MasterFields :=
FrmReports.tblReportTool.FieldByName('Pri_Key').AsString;
The creation of the components.
// Table
Table := TCRepTable.Create(Self);
Table.Name := 'tbl' + RepTableNames[I];
SetEnumProp(Table, 'Table', 'crt' + RepTableNames[I]);
Table.Repository := CRepository1;
// DataSource
DataSource := TDataSource.Create(Self);
DataSource.Name := 'ds' + RepTableNames[I];
DataSource.DataSet := Table;
// PipeLine
PipeLine := TppDBPipeLine.Create(Self);
PipeLine.DataSource := DataSource;
PipeLine.Name := 'pl' + RepTableNames[I];
PipeLine.UserName := RepTableNames[I];
Can someone please tell me what I am doing wrong?
Thanks in advance and best regards,
Mischa E.J. Hoogendoorn
I've got a strange problem. If there are no detail records, my masterfields
will not show. When there is a detail record (or more) then it's all
displayed correctly. Since I create the components in my sourcecode, I will
give you a example.
Detail table:
aTable := TCRepTable(DmMain.Components[i]);
aTable.MasterSource := TDataSource(DmMain.FindComponent('ds'
+
FrmReports.tblReportTool.FieldByName('Pri_File').AsString));
aTable.IndexFieldNames:=
FrmReports.tblReportTool.FieldByName('Sec_Key').AsString;
aTable.MasterFields :=
FrmReports.tblReportTool.FieldByName('Pri_Key').AsString;
The creation of the components.
// Table
Table := TCRepTable.Create(Self);
Table.Name := 'tbl' + RepTableNames[I];
SetEnumProp(Table, 'Table', 'crt' + RepTableNames[I]);
Table.Repository := CRepository1;
// DataSource
DataSource := TDataSource.Create(Self);
DataSource.Name := 'ds' + RepTableNames[I];
DataSource.DataSet := Table;
// PipeLine
PipeLine := TppDBPipeLine.Create(Self);
PipeLine.DataSource := DataSource;
PipeLine.Name := 'pl' + RepTableNames[I];
PipeLine.UserName := RepTableNames[I];
Can someone please tell me what I am doing wrong?
Thanks in advance and best regards,
Mischa E.J. Hoogendoorn
This discussion has been closed.
Comments
I think you have to set property 'SkipWhenNoRecords' of the detail pipeline to 'False'.
HTH,
Chris Ueberall;