How to assign DataPipe to subreport in runtime...
I have just downloaded ReportBuilder, so I'm new to it.
I have to load report from a database, create local datasources,
datapipelines and connect the neccessay stuff (Dataseta are on the form).
Report has a subreport and I don't know how to assign datapipe to the
subreport in code!
How do I access subreports on report in code?
How do I create Field links in DataPipelines in code?
Thanks.
Ivan
PS
And yes, I'm using Borland Builder (C++).
I have to load report from a database, create local datasources,
datapipelines and connect the neccessay stuff (Dataseta are on the form).
Report has a subreport and I don't know how to assign datapipe to the
subreport in code!
How do I access subreports on report in code?
How do I create Field links in DataPipelines in code?
Thanks.
Ivan
PS
And yes, I'm using Borland Builder (C++).
This discussion has been closed.
Comments
TppSubreport.Report.Datapipeline. The subreport class wraps a report object
so that it effectively is an embedded report.
To find the subreport, you can perform a report object loop. In the object
loop, check to see if the component is a TppSubreport. By passing a report
object in the function, you can recursively look for subreports by passing
Subreport.Report when you find a subreport:
procedure TForm1.AssignFontToReport(aFont: TFont; aReport: TppCustomReport);
var
liBand: Integer;
liObject: Integer;
lObject: TppComponent;
begin
for liBand := 0 to aReport.BandCount-1 do
begin
for liObject := 0 to aReport.Bands[liBand].ObjectCount-1 do
begin
lObject := aReport.Bands[liBand].Objects[liObject];
if lObject is TppSubreport then
AssignFontToReport(aFont, TppSubreport(lObject).Report)
else if lObject.HasFont then
lObject.Font := aFont;
end;
end;
end;
Are you using master field links to perform master detail linking as it is
done in DADE by using a single query for all detail records, instead of
letting Delphi fire a detail query every tim ethe master record changes?
Here is a demo of this approach:
http://www.digital-metaphors.com/tips/MagicMasterDetail.zip
Below is an article on how to create the links at runtime:
Cheers,
Jim Bennett
Digital Metaphors
---------------------------------------------------------
Tech Tip: Define Master/Detail DataPipeline Links in Code
---------------------------------------------------------
Defining a Master/Detail relationship for a DataPipeline
requires that the detail pipeline have the
following properties defined:
1. MasterDataPipeline
2. MasterFieldLinks
At Delphi design-time you can use the object inspector
and the DataPipeline's FieldLinks editor to define
the master/detail relationship.
The following example illustrates how to define the
master/detail relationship dynamically at run-time.
var
lFieldLink: TppMasterFieldLink;
begin
{define the master/detail pipeline relationship}
plDetail.MasterDataPipeline := plMaster;
{create a new field link }
lFieldLink := TppMasterFieldLink.Create(nil);
lFieldLink.Parent := plDetail;
{assign the detail field name}
lFieldLink.DetailFieldName := 'CustNo';
{assign the master field name}
lFieldLink.MasterFieldName := 'CustNo';
end;
Note: The DataPipeline linking requires the records in the detail dataset to
be ordered by the linking fields. In the above example, the detail data must
be ordered by CustNo.
--
Tech Support mailto:support@digital-metaphors.com
Digital Metaphors http://www.digital-metaphors.com
http://www.digital-metaphors.com
info@digital-metaphors.com