Question
“How do I create a DataPipeline in code?”
Solution
Datapipelines can easily be created dynamically in code by assigning a few key properties.
- Create the TppDBPipeline object:
FDataPipeline := TppDBPipeline.Create(Self);
- Give the pipeline a recognizable name.
FDataPipeline.Name := ‘plCustomers’;
FDataPipeline.UserName := ‘Customers’;
- Assign the DataSource property.
FDataPipeline.DataSource := dsCustomers;
- Assign any other properties you may need.
FDataPipeline.SkipWhenNoRecords := True;
Download: CreateDataPipeline.zip
Sample Delphi code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
procedure TForm1.Button1Click(Sender: TObject); begin CreateDataPipeline; pPReport1.DataPipeline := FDataPipeline; ppReport1.Print; end; procedure TForm1.CreateDataPipeline; begin FDataPipeline := TppDBPipeline.Create(Self); FDataPipeline.RangeBegin := rbFirstRecord; FDataPipeline.RangeEnd := reLastRecord; FDataPipeline.RangeEndCount := 0; FDataPipeline.SkipWhenNoRecords := True; FDataPipeline.DataSource := DataSource1; FDataPipeline.Name := 'plCustomers'; FDataPipeline.UserName := 'Customers'; end; procedure TForm1.FormDestroy(Sender: TObject); begin FDataPipeline.Free; end; |