rbWiki > Data Access > Fundamentals > How To...Create a DataPipeline in Code

How To...Create a DataPipeline in Code

Table of contents
  1. 1. Question 
  2. 2. Solution

Question 

"How do I create a DataPipeline in code?" 

Solution

Datapipelines can easily be created dynamically in code by assigning a few key properties.

  1. Create the TppDBPipeline object:
  2.      FDataPipeline := TppDBPipeline.Create(Self);

  3. Give the pipeline a recognizable name.
  4.      FDataPipeline.Name := 'plCustomers';
         FDataPipeline.UserName := 'Customers';

  5. Assign the DataSource property.
  6.      FDataPipeline.DataSource := dsCustomers;

  7. Assign any other properties you may need.
  8.      FDataPipeline.SkipWhenNoRecords := True;

Download: CreateDataPipeline.zip

Sample Delphi code:

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;
Tags
none

Files (0)

 
You must login to post a comment.