Add Records into TfrxUserDataSet
I have a dataset where I am trying to place into the TfrxUserDataSet. I am not sure how to do this.
Here is some of the code.
unit ReportPrinter;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IO_Tools, frxClass;
type
TfrmReport = class(TForm)
ds : TfrxUserDataSet;
frxReport : TfrxReport;
public
procedure ReportSetup;
procedure ScreenPreview;
end;
var
frmReport: TfrmReport;
implementation
uses MainForm;
{$R *.dfm}
(* Get Data from the MainForm to be placed onto the report *)
procedure ReportSetup;
type
//Declare Report Record
TReportRecord = record
Order : string[20];
Tab : string[20];
ReportSection : String[50];
SubSection : String[20];
CommonFieldName : String[50];
CommonLabelName : String[50];
HotFieldName : String[50];
HotLabelName : String[50];
ColdFieldName : String[50];
ColdLabelName : String[50];
end;
var
ReportRecords : array[1..89] of tReportRecord;
begin
//Add Records to TReportRecord
with ReportRecords[1] do
begin
Order := '1.01';
Tab := '';
ReportSection := 'Company';
SubSection := '';
CommonFieldName := 'tester';
CommonLabelName := '';
HotFieldName := '';
HotLabelName := '';
ColdFieldName := '';
ColdLabelName := '';
end;
// (88 more records come after this)
//Fill dataset
// I am not sure how to add these records to the ds dataset
frmReport.ds.RangeEnd := recount;
frmReport.ds.RangeEndCount := 89;
end;
procedure ScreenPreview();
begin
ReportSetup;
frxReport.PreviewOptions.Maximized := false;
frxFinReport.PreviewOptions.Buttons :=[pbPrint, pbPageSetup, pbNavigator];
frxReport.ShowReport;
end;
I don't seem to know how to attach the records that were created in the ReportSetup procedure into the dataset.
Any help would be greatly appreciated.
Eddi Rae
Here is some of the code.
unit ReportPrinter;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IO_Tools, frxClass;
type
TfrmReport = class(TForm)
ds : TfrxUserDataSet;
frxReport : TfrxReport;
public
procedure ReportSetup;
procedure ScreenPreview;
end;
var
frmReport: TfrmReport;
implementation
uses MainForm;
{$R *.dfm}
(* Get Data from the MainForm to be placed onto the report *)
procedure ReportSetup;
type
//Declare Report Record
TReportRecord = record
Order : string[20];
Tab : string[20];
ReportSection : String[50];
SubSection : String[20];
CommonFieldName : String[50];
CommonLabelName : String[50];
HotFieldName : String[50];
HotLabelName : String[50];
ColdFieldName : String[50];
ColdLabelName : String[50];
end;
var
ReportRecords : array[1..89] of tReportRecord;
begin
//Add Records to TReportRecord
with ReportRecords[1] do
begin
Order := '1.01';
Tab := '';
ReportSection := 'Company';
SubSection := '';
CommonFieldName := 'tester';
CommonLabelName := '';
HotFieldName := '';
HotLabelName := '';
ColdFieldName := '';
ColdLabelName := '';
end;
// (88 more records come after this)
//Fill dataset
// I am not sure how to add these records to the ds dataset
frmReport.ds.RangeEnd := recount;
frmReport.ds.RangeEndCount := 89;
end;
procedure ScreenPreview();
begin
ReportSetup;
frxReport.PreviewOptions.Maximized := false;
frxFinReport.PreviewOptions.Buttons :=[pbPrint, pbPageSetup, pbNavigator];
frxReport.ShowReport;
end;
I don't seem to know how to attach the records that were created in the ReportSetup procedure into the dataset.
Any help would be greatly appreciated.
Eddi Rae
Comments
ReportRecords : array[1..89, 1..2, 1..2, 1..2, 1..2, 1..2, 1..2, 1..2, 1..2, 1..2, 1..2] of String = ( ; //Record Number, Order, Tab, ReportSection, SubSection, CommonFieldName, CommonLabelName, HotFieldName, HotLabelName, ColdFieldName, ColdLabelName
('01', '1.01','','Company','','tester', '', '', '', '', '')
all the rest of the records
)
Would I have to do the above or could I fill the dataset with the records as I have them defined?
I am still not seeing how to fill the dataset with ALL of the records in the demo that you said to look at.
I am not very familiar on coding in Delphi, so just telling me what to use without an example doesn't help me at all.
I am trying to use what I initially posted and I am not getting any values when I run the report. I am thinking that this is the way to do it, but I don't see how to connect to the report. I do have the Master linked to the dataset. So how do I link the record type into the dataset.