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

DataDictionary and Create Datamodule at Runtime

edited October 2005 in DADE
Hi,

i will create a report at runtime and i am having problems with the
datadictionary.
after creating the datamodule i attach a dataview to it like this. I can the
the query
in the datadesginer, but it has not used the datadictionary. WHY ???
if i add a new query in the datamodule using the desginer, this one will use
the
datadictionary. So the Datadictionary is set correctly. Thinks that
something is missing.

lDM := TdaDataModule.CreateForReport(m_Report);
lDataView := TdaADOQueryDataView.Create(lDM);
lDataView.Parent := ldm;
lDataView.Init;

lDataView.SQL.DatabaseName := m_dbKalk.Name;
lDataView.SQL.DatabaseType := dtMySQL;
lDataView.SQL.SQLType := sqSQL1;
lDataView.SQL.DataPipelineName := 'Kunden';

lSQL := lDataView.SQL;
lSQL.DatabaseName := m_dbKalk.Name;
lSQL.DatabaseType := dtMySQL;
lSQL.SQLType := sqSQL1;
lSQL.DataPipelineName := 'Kunden';
lSQL.UserName :='KundenTablle';

// edit the SQLText
lSQLText := TStringList.Create;
try
lSQLText.Text := 'SELECT * from Kunden'
lSQL.SQLText := lSQLText;
finally
lSQLText.Free;
end;

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

lDataView.OutOfSync;
lDataView.Sync;

m_Designer.ShowModal;

Comments

  • edited October 2005

    You can set the TdaSQL.DataDictionary property to reference a DataDictionary
    object.

    The Query Designer and Query Wizard use the methods of the TdaSQL object to
    build an object based description of a SQL statement. The TdaSQL object
    generates the SQL text. And the QueryDataview creates the
    DataPipeline.Fields[] objects that contain the user friendly field aliases.

    At run-time you can use the TdaSQLBuilder object introduced by RB 9 to build
    thje TdaSQL object. See TdaSQLBuilder in the online help and navigate to the
    subtopics for code examples.

    If you set the SQLText directly, then the sql text is assigned to the query
    object and whatever field names you use in the sql text will be used to
    create the datapipeline field objects. Alsothe linking and autosearch
    support will not work.




    --
    Nard Moseley
    Digital Metaphors Corporation
    http://www.digital-metaphors.com



    Best regards,

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