Question
“How do I link a pipeline (dataview) I’ve created in DADE with a standard pipeline I’ve placed on my form/datamodule or vice versa?”
Solution
Gain access to the pipeline object of the TppDataView via the daGetDataModule routine. Then manually link the pipelines as you would normally in code using a TppMasterFieldLink object.
Download: LinkDADEPipeToStandardPipe.zip
LinkStandardPipeToDADEPipe.zip
Sample Delphi code:
Link a DADE pipeline to a standard pipeline:
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 30 31 32 33 34 35 36 37 38 39 40 41 42 |
procedure TForm1.FormCreate(Sender: TObject); var lLink: TppMasterFieldLink; lMasterPipeline: TppDatapipeline; lDetailPipeline: TppDatapipeline; begin lMasterPipeline := plCustomer; lDetailPipeline := GetDADEDataPipeline(ppReport1); lDetailPipeline.MasterDatapipeline := lMasterPipeline; lLink := TppMasterFieldLink.Create(nil); lLink.Parent := lDetailPipeline; lLink.Name := lDetailPipeline.GetValidName(lLink); lLink.DetailFieldName := 'CustNo'; lLink.MasterFieldName := 'CustNo'; end; function TForm1.GetDADEDataPipeline(aReport: TppReport): TppDataPipeline; var lDataModule: TdaDataModule; lDataview: TdaQueryDataview; begin lDataModule := daGetDataModule(aReport); if (lDataModule <> nil) then begin lDataview := TdaQueryDataview(lDataModule.DataViews[0]); {need to set active true in order to use the link on the pipeline so DADE won't try to fire the MAGIC SQL generation.} lDataView.Active := True; Result := lDataview.DataPipelines[0]; end else Result := nil; end; |
Link a standard pipeline to a DADE pipeline:
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 |
procedure TForm1.FormCreate(Sender: TObject); var lLink: TppMasterFieldLink; begin ppDBPipeline1.MasterDataPipeline := GetDADEDataPipeline(ppReport1); lLink := TppMasterFieldLink.Create(ppDBPipeline1); lLink.Parent := ppDBPipeline1; lLink.Name := ppDBPipeline1.GetValidName(lLink); lLink.DetailFieldName := 'CustNo'; lLink.MasterFieldName := 'CustNo'; end; function TForm1.GetDADEDataPipeline(aReport: TppReport): TppDataPipeline; var lDataModule: TdaDataModule; begin lDataModule := daGetDataModule(aReport); if (lDataModule <> nil) then Result := lDataModule.DataViews[0].DataPipelines[0] else Result := nil; end; |