TppDBText
Hi,
I am creating a report through code. I am using labels for the headers and
dbText for the detail line. I am pulling the data from a TwwDBGrid. I need
to create this report through code, because the user will be changing the
order of the columns in the grid and the report needs to be printed in the
same order. I am using dbText hoping it would loop through the grid and
output through the detail line. I am doing the same kind of thing (pulling
data from a TwwDBGrid) in another report using labels for headers and dbText
for the detail line, but I am using the the RB IDE to do this and it works
fine using the OnGetText Event for the data from the grid. It pulls in the
right amount of lines and fields. Although when I try to do this same thing
in code, nothing shows up in the detail line. I have stepped through with
debugging and it is getting the data, just not showing it on the detail
line. Any suggestions?
TIA,
Jada Case
-------------------------------------------------
// report
reportMarketGrid := TppReport.Create(self);
reportMarketGrid.CreateDefaultBands;
labelName := TppLabel.Create(self);
labelName.Band := reportMarketGrid.HeaderBand;
labelName.spLeft := 2;
labelName.spTop := 2;
labelName.Font.Size := 14;
// need arial here
// need bold here
labelName.Caption := 'CBIA Health Connections';
// Creating Display labels in the Header Band
labelOne := TppLabel.Create(self);
labelOne.Band := reportMarketGrid.HeaderBand;
labelOne.spLeft := 20;
labelOne.spTop := 100;
// need arial here
labelOne.Caption := dbgridMarketTotals.Columns[1].DisplayLabel;
// Creating dtTexts for the data fields selected
dbTextOne := TppDBText.Create(self);
dbTextOne.Band := reportMarketGrid.DetailBand;
dbTextOne.spLeft := labelOne.spLeft;
dbTextOne.spTop := labelOne.spTop;
dbTextOne.DataField := dbgridMarketTotals.GetFieldValue(1);
reportMarketGrid.PrinterSetup.PaperHeight := 8.5;
reportMarketGrid.PrinterSetup.PaperWidth := 14;
ppViewer1.Report :=
reportMarketGrid;
reportMarketGrid.PrintToDevices;
reportMarketGrid.Free;
I am creating a report through code. I am using labels for the headers and
dbText for the detail line. I am pulling the data from a TwwDBGrid. I need
to create this report through code, because the user will be changing the
order of the columns in the grid and the report needs to be printed in the
same order. I am using dbText hoping it would loop through the grid and
output through the detail line. I am doing the same kind of thing (pulling
data from a TwwDBGrid) in another report using labels for headers and dbText
for the detail line, but I am using the the RB IDE to do this and it works
fine using the OnGetText Event for the data from the grid. It pulls in the
right amount of lines and fields. Although when I try to do this same thing
in code, nothing shows up in the detail line. I have stepped through with
debugging and it is getting the data, just not showing it on the detail
line. Any suggestions?
TIA,
Jada Case
-------------------------------------------------
// report
reportMarketGrid := TppReport.Create(self);
reportMarketGrid.CreateDefaultBands;
labelName := TppLabel.Create(self);
labelName.Band := reportMarketGrid.HeaderBand;
labelName.spLeft := 2;
labelName.spTop := 2;
labelName.Font.Size := 14;
// need arial here
// need bold here
labelName.Caption := 'CBIA Health Connections';
// Creating Display labels in the Header Band
labelOne := TppLabel.Create(self);
labelOne.Band := reportMarketGrid.HeaderBand;
labelOne.spLeft := 20;
labelOne.spTop := 100;
// need arial here
labelOne.Caption := dbgridMarketTotals.Columns[1].DisplayLabel;
// Creating dtTexts for the data fields selected
dbTextOne := TppDBText.Create(self);
dbTextOne.Band := reportMarketGrid.DetailBand;
dbTextOne.spLeft := labelOne.spLeft;
dbTextOne.spTop := labelOne.spTop;
dbTextOne.DataField := dbgridMarketTotals.GetFieldValue(1);
reportMarketGrid.PrinterSetup.PaperHeight := 8.5;
reportMarketGrid.PrinterSetup.PaperWidth := 14;
ppViewer1.Report :=
reportMarketGrid;
reportMarketGrid.PrintToDevices;
reportMarketGrid.Free;
This discussion has been closed.
Comments
You need to assign the Report.DataPipeline property and the
DBText.DataPipelein property.
The Report will traverse the DataPipeline to which it is assigned. A
DBText will print data from the current record of the datapipeline to
which it is assigned.
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
data from. Or do I assign the pipeline to the source the TwwDBGrid is
hooked to and call the ongettext event?
assigned datapipeline. Since you want to pull data from the grid, you may
want to look at our JITPipeline. There is an example of using the
JITPipeline on a grid in our installed demos. See number 137 in the main
reports demo project.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com