Problem with DBCrossView
Hi,
I'm having some trouble with the TfrxDBCrossView component..
I'm dynamically creating report and cross view from code.
I add every field i need BUT i can't see the result grid in the report preview (Report.ShowReport;).
If i go in editing mode (Report.DesignReport;) changing the cross view, then i can see the preview.
Anyone can help me? I think i should call a method but i can't find it.
Greetings, Viper
I'm having some trouble with the TfrxDBCrossView component..
I'm dynamically creating report and cross view from code.
I add every field i need BUT i can't see the result grid in the report preview (Report.ShowReport;).
If i go in editing mode (Report.DesignReport;) changing the cross view, then i can see the preview.
Anyone can help me? I think i should call a method but i can't find it.
Greetings, Viper
Comments
post it in the binaries news group.
Adding fields..
1 you should be adding your fields before the end; of the cross creation
2 your levels need to be set correctly.
here is a sample using the demodata crosstab.db
procedure TForm1.Button5Click(Sender: TObject);
var
report:tfrxreport;
dataset:tfrxdbdataset;
datapage:tfrxdatapage;
page:tfrxreportpage;
cross:tfrxdbcrossview;
begin
Report := TfrxReport.Create(Self);
Report.CreateUniqueName;
Report.PreviewOptions.Buttons:=[pbPrint,pbExport,pbZoom,pbFind,pbOutline,pbPageSetup,pbTools,pbNavigator,pbExportQuick];
DataSet := TfrxDBDataset.Create(self);
DataSet.Name := 'ReportDataset1';
DataSet.DataSource := reportdata.CrossSource;// linked to crosstab demo data in data module
Report.DataSets.Add(Dataset);
DataPage := TfrxDataPage.Create(Report);
Page := TfrxReportPage.Create(Report);
Page.CreateUniqueName;
Page.SetDefaults;
Cross := TfrxDBCrossView.Create(Page);
Cross.DataSet := DataSet;
with Cross do
begin
CreateUniqueName;
Top := 45;
Left := 0;
Width := 100;
Height := 100;
ShowTitle := False;
ShowCorner := False;
ShowColumnHeader := True;
AutoSize := True;
Border := True;
DownThenAcross := False;
RepeatHeaders := True;
PlainCells := True;
JoinEqualCells := False;
ShowRowHeader := True;
ShowColumnTotal := True;
ShowRowTotal := True;
rowfields.Add('Name');
rowlevels:=1;
cellfields.Add('Salary');
cellLevels := 1;
columnfields.Add('Year');
columnlevels:=1;
end;
report.showReport;
end;
and all works as i wish