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

DataView change

edited May 2004 in End User
Hi,

I use RB 7.03 and D.6

1- I try to create a dataview in run time. So I write this function for this
:

procedure InitDataView(aReport : TppReport);
var
lDataModule : TdaDataModule;
lDataView : TdaADOQueryDataView;
lPipeLine : TppDBPipeline;
aSQL : TdaSQL;
aTable : TdaTable;
i : integer;
begin
aSQL := nil;
lDataModule := daGetDataModule(aReport);
if assigned(lDataModule) then
lDataModule.Destroy;
lDataModule := TdaDataModule.CreateForReport(aReport);
lDataView := TdaADOQueryDataView.Create(lDataModule);
lDataView.Name := 'badge';
lDataView.Parent := lDataModule;
lDataView.Init;

aSQL := lDataView.SQL;
aSQL.DatabaseName := 'ADOConnection1';

aTable := aSQL.AddTable('G_PROFILE');
aSQL.AddSelectField(aTable, 'GP_NAME');
aSQL.AddSelectField(aTable, 'GP_IDENT');
aSQL.AddSelectField(aTable, 'GP_FIRSTNAME');
aSQL.AddSelectField(aTable, 'GP_PHOTO');

lPipeline := TppDBPipeline(lDataView.DataPipelines[0]);
lPipeLine.Name := 'badge';
lPipeLine.UserName := 'badge';

lDataView.OutOfSync;
lDataView.Sync;

aReport.DataPipeline := lPipeLine;
end;

2- Before call this function I see "Image3.jpg" on the dataview table list
grid.

3- After call this function I see "Image4.jpg" on the dataview table list
grid.

What's wrong with my code? Why the table list change in the dataview?

thanks.

Comments

  • edited May 2004

    There are a number of the TppDesigner.DataSettings properties that are
    applied to the TdaSQL object when it is created. I think you need to assign
    more of these properties:

    For examlple:

    TdaSQL.DatabaseName = 'DBDEMOS'
    TdaSQL.DatabaseType = dtParadox
    TdaSQL.DataPipelineName = 'customer'
    TdaSQL.IsCaseSensitive = True

    You may also need to set

    TdaSQL.DataDictionary




    --
    Nard Moseley
    Digital Metaphors Corporation
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.