Converting existing reports when database fields and tables change...
Hi,
Has anyone had any experience updating saved reports (RTM files) to match
their database after making changes such as moving fields from one table to
another, and deleting old tables that are not used any more (because the
fields have moved to another table).
I'd appreciate hearing any tips or seeing any code that anyone may have used
in this regard.
Sincererly,
Vinnie Murdico
Has anyone had any experience updating saved reports (RTM files) to match
their database after making changes such as moving fields from one table to
another, and deleting old tables that are not used any more (because the
fields have moved to another table).
I'd appreciate hearing any tips or seeing any code that anyone may have used
in this regard.
Sincererly,
Vinnie Murdico
This discussion has been closed.
Comments
(You'll have to change the queries anyway)? In that way you shouldn't have to
change nothing on the reports.
SELECT
Field1 as OldField1Value
FROM
etc....
through your reports and then iterate through all the object in the report
using the loop below.
procedure UpdateReport(aReport: TppReport)'
for (liBands := 0 to aReport1.BandCount - 1) do
for (liObjects := 0 to aReport1.Bands[liBands].ObjectCount - 1) do
begin
lObject := aReport1.Bands[liBands].Objects[liObject];
if (lObject is TppSubreport) then
UpdateReport(TppSubreport(aReport).Report)
else if (lObject is TppComponent) then
begin
lComponent := TppComponent(lObject);
if lComponent.IsDataAware
// update lComponent.DataPipeline and lComponent.DataField
end;
end;
The other option is to parse through the RTMs themselves updating occurences
of 'DataField' and 'DataPipeline'. For example:
for all templates
begin
lStream := TFileStream.Create('aTemplate', fmOpenRead);
while not end of stream do
begin
liIndex := Pos('DataField');
if (liIndex := -1) then
begin
// replace data field name
liIndex := Pos('DataPipeline') then
// replace data pipeline name
end;
end;
end;
--
Cheers,
Alexander Kramnik
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com