Before launching the designer set the Designer.Datasettings property to the new database. If you want to change it after a report is loaded, first change the designer's property. Then extract the DADE data module from the report and loop through the dataviews in the datamodule. Once you have the datamodule, you can set the properties on the TdaSQL object. However, you also need to be aware that the field names and table names may not match up to the other database. You'll have to change these as well. Then save the tempalte down in the new format. Here is the code to extract the SQL object from the first dataview, you'll need to change this around to not return the SQL object, but loop through the dataviews to get SQL objects and modifying them. Also, look in daSQL.pas for the properties available on the TdaSQL object.
function TForm1.GetSQLObject(aReport: TppReport): TdaSQL; var lDataModule: TdaDataModule; lDataView: TdaDataView; begin
Result := nil;
{get the datamodule} lDataModule := daGetDataModule(aReport);
if (lDataModule <> nil) then begin lDataView := lDataModule.DataViews[0];
if (lDataView <> nil) and (lDataView is TdaQueryDataView) then Result := TdaQueryDataView(lDataView).SQL;
Comments
new database. If you want to change it after a report is loaded, first
change the designer's property. Then extract the DADE data module from the
report and loop through the dataviews in the datamodule. Once you have the
datamodule, you can set the properties on the TdaSQL object. However, you
also need to be aware that the field names and table names may not match up
to the other database. You'll have to change these as well. Then save the
tempalte down in the new format. Here is the code to extract the SQL object
from the first dataview, you'll need to change this around to not return the
SQL object, but loop through the dataviews to get SQL objects and modifying
them. Also, look in daSQL.pas for the properties available on the TdaSQL
object.
function TForm1.GetSQLObject(aReport: TppReport): TdaSQL;
var
lDataModule: TdaDataModule;
lDataView: TdaDataView;
begin
Result := nil;
{get the datamodule}
lDataModule := daGetDataModule(aReport);
if (lDataModule <> nil) then
begin
lDataView := lDataModule.DataViews[0];
if (lDataView <> nil) and (lDataView is TdaQueryDataView) then
Result := TdaQueryDataView(lDataView).SQL;
end;
end;
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com