Search RTM file
I need to change the code of many variables in an RTM file but am not sure
which reports have this variable. Opening every report and searching every
variable would be painful. Is there a way to convert or save the RTM
variable code as text? We already save the template as text, but the code
is not searchable.
Thanks
which reports have this variable. Opening every report and searching every
variable would be painful. Is there a way to convert or save the RTM
variable code as text? We already save the template as text, but the code
is not searchable.
Thanks
This discussion has been closed.
Comments
Although it is not possible to search RAP code inside a template, you can
try a different approach of iterating through the code module and altering
code.
http://www.digital-metaphors.com/tips/RAPModifyPrograms.zip
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
code, but with the code below it does not seem to be searching the
subreports. Please help.
// get the code for the report
vCodeModule := raGetCodeModule(ppReport1);
if not Assigned(vCodeModule) then
Exit;
// event-handlers
for vIndex := 0 to vCodeModule.ProgramCount-1 do
begin
vProgram := vCodeModule.Programs[vIndex];
vSourceString := vProgram.Source;
_FindTextInSouceString;
end;
// global programs
for vIndex := 0 to vCodeModule.AllGlobalProgramCount-1 do
begin
vProgram := vCodeModule.AllGlobalPrograms[vIndex];
if (vProgram <> nil) then
begin
vSourceString := vProgram.Source;
_FindTextInSouceString;
end;
end;
There is on CodeModule per report/subreport. You will need to loop through
each TppChildReport.CodeModule to access the RAP code in a subreport.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
give me an example? Thanks!
can access the code module directly...
lCodeModule := TraCodeModule(ppChildReport1.CodeModule);
If you need to loop through the report and search for subreports, you can
use a report object loop. When you come across a TppSubreport object, you
can use the TppSubreport.Report to access the TppChildReport object needed.
----------------------------------------------
Tech Tip: Loop Thru All Objects in a Report
---------------------------------------------
A ReportBuilder report is composed of a set
of components. The basic structure is
Reports.Bands[].Objects[]
The bands and objects within the report can
be accessed directly by object name or
via the Bands and Objects array properties.
Below is an example of using the Bands and
Objects array properties to change the font for
all objects on a report.
uses
ppClass;
procedure AssignFontToReport(aFont: TFont; aReport: TppCustomReport);
var
liBand: Integer;
liObject: Integer;
lObject: TppComponent;
begin
for liBand := 0 to aReport.BandCount-1 do
for liObject := 0 to aReport.Bands[liBand].ObjectCount-1 do
begin
lObject := aReport.Bands[liBand].Objects[liObject];
if lObject.HasFont then
lObject.Font := aFont;
end;
end;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com