Home DADE
New Blog Posts: Merging Reports - Part 1 and Part 2

Load SQL into DADE at runtime

edited September 2002 in DADE
Hello,

I'm trying to create a routine will allow me to load a TdaBDEQueryDataView
with an SQL statement and present the columns in the SQL statement to the
user so they can then place the columns on the page as they desire and run
the report. The routine as presently constituted will create the dataview,
but it doesn't 'load' the SQL and show the columns. Here's what I have,
based on what I've been able to glean out of this newsgroup and the tech
tips:

procedure TfrmMplusVRB.SetupLegacyReport(const aSQL: String);
var
lDataModule : TdaDataModule;
lDataView : TdaBDEQueryDataView;
lDataPipeline : TppChildBDEPipeline;
begin
lDataModule := daGetDataModule(ppReport1);

if (lDataModule = nil) then
lDataModule := TdaDataModule.CreateForReport(ppReport1);

lDataView := TdaBDEQueryDataView.Create(lDataModule);

with lDataView do
begin
Init;
Parent := lDataModule;
Report := ppReport1;
UserName := 'Query_The_patient_query';
Name := 'MyDataView';
end;

with lDataView.SQL do
begin
DataPipelineName := 'LegacyQuery';
DatabaseName := 'VRB';
DatabaseType := dtInterbase;
SQLType := sqSQL2;
SQLText.Text := aSQL;
Resync;
end;
lDataView.SQLChanged;

lDataPipeline := TppChildBDEPipeline(lDataView.DataPipelines[0]);
lDataPipeline.Name := 'LegacyQuery';
lDataPipeline.AutoCreateFields := true;

end;


I know this approach limits the end user's ability to refine the SQL, but in
this case it is OK. The SQL will be coming from our current (soon-to-be
'legacy') reporting tool. The user will have specified the columns, filters
and sort order in that application.

I've got to be missing something downright silly here, but I'm not seeing
it. Any help provided will be greatly appreciated.

Richard P. Kelly
ManagementPlus.

Comments

This discussion has been closed.