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

Need to Read the Binary in an rtm file

edited March 2004 in RAP
Hi,
Does any one know how to read the binar n the rtm text and convert it to
text so that I search it?
I have heard of RAP2Text. Maybe I could use that if someone could tell me
where I could get a copy.
Thanks,
Les Prigmore

Comments

  • edited March 2004

    Try searching this newsgroup for posts by Chris Ueberall, and perhaps try
    emailing a request to him.

    --

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


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited March 2004
    Nard,

    I looked for mention of "RAP2Text" and didn't find anything useful.
    Also I couldn't find a good email address for Chris Ueberall, so I couldn't
    ask
    him for a copy of "RAP2Text" directly.

    My previous typing has embarrassed me, so let me be a bit more descriptive.

    Our application contains 268 reports. Ocassionally a RAP function will
    change. When a RAP function changes, becomes obsolete or for whatever reason
    I would like to know which reports a given RAP function is referenced. The
    RAP functions are referenced in the binary portion of the rtm file and I
    don't know how to convert the binary section to text so that I can search
    for a string in it.

    So what I would like to be able to do is search the binary section of the
    rtm files for references to a RAP function, or any string.

    Do you have a utility that will do that. Or could you direct me in
    the proper approach to writing a utility to convert the binary section of an
    rtm to text so
    that I can search it?

    Thanks,
    Les Prigmore

  • edited March 2004

    I wiil try to contact Chris Ueberall.

    We do not have any utilities here that can read the RAP binary code.



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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited March 2004

    My e-mail to Chris failed to be delivered. :(


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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2004
    Nard,

    Well, I think that I am dead in the water until I get further direction.
    But, Chris is bound to turn up somewhere

    someday. Keep this problem in mind and let me know when you might figure
    something out, find someone who can help or discover some interface that can
    communicate with Chris.

    There has got to be a way to do this! Report builder's "Calc" tab does it
    very well.

    Thanks,

    Les Prigmore

  • edited April 2004
    Hi,

    I don't know if this helps, but I made a little procedure so that
    a user could view/print the source code. I then added it to the
    designers menu bar. I have modified it here to build a string
    (CodeText) instead of printing for your situtation. There is the
    basics:

    procedure TMyForm.ViewAllSourceCode1Click(Sender: TObject);
    var
    ExitNow,
    ProblemFound: boolean;
    CodeText: string;
    CurReport: TppReport;

    procedure IncludeSubReports(R: TppReport); forward;

    procedure AddRep(s: string; Rep: TppCustomReport; GlobalPrgm: TraProgram);
    var
    mr: word;
    i: integer;
    begin
    if GlobalPrgm<>nil then
    begin
    CodeText:=CodeText+'SubReport: '+s+#10#13;
    CodeText:=CodeText+'Routine: '+GlobalPrgm.ProgramName+#10#13;
    GlobalPrgm.Reset(true);
    GlobalPrgm.Compile(false,false);
    if GlobalPrgm.SyntaxError then
    for i:=0 to GlobalPrgm.SyntaxErrorCount-1 do
    with GlobalPrgm.SyntaxErrors[i] do
    CodeText:=CodeText+'Error at line: '+IntToStr(LineNo)+'
    Column: '+IntToStr(CharPos+1)+#10#13;
    CodeText:=CodeText+#10#13;
    for i:=0 to GlobalPrgm.SourceLines.Count-1 do
    CodeText:=CodeText+copy(IntToStr(i+1)+' ',1,4)+'
    '+GlobalPrgm.SourceLines[i]+#10#13;

    CodeText:=CodeText+#10#13'----------------------------------------------'#10
    #13;

    end;
    end;

    procedure IncludeReport(s: string; Rep: TppCustomReport);
    var
    p: integer;
    CodeModule: TraCodeModule;
    begin
    CodeModule:=raGetCodeModule(Rep);
    if CodeModule=nil then
    begin
    exit;
    end;

    AddRep(s,Rep,CodeModule.GlobalVarProgram);

    AddRep(s,Rep,CodeModule.GlobalCreateProgram);

    p:=CodeModule.GlobalProgramCount-1;
    while p>=0 do
    begin
    AddRep(s,Rep,CodeModule.GlobalPrograms[p]);
    dec(p);
    if ExitNow
    then exit;
    end;

    p:=CodeModule.ProgramCount-1;
    while p>=0 do
    begin
    AddRep(s,Rep,CodeModule.Programs[p]);
    dec(p);
    if ExitNow
    then exit;
    end;
    end;

    procedure LookAtComponent(CurComponent: TComponent);
    var
    NumObjects: integer;
    i: integer;
    FN: string;
    begin
    if CurComponent.InheritsFrom(TppSubReport) and
    (TppSubReport(CurComponent).Report<>nil) then
    with TppSubReport(CurComponent) do
    begin
    IncludeReport(UserName,TppCustomReport(Report));
    if ExitNow
    then exit;
    IncludeSubReports(TppReport(Report));
    end
    end;

    procedure LookAtBands(CurBand: TppBand);
    var
    NumObjects: integer;
    i: integer;
    begin
    NumObjects:=CurBand.ObjectCount;
    for i:=0 to NumObjects-1 do
    begin
    LookAtComponent(TComponent(CurBand.Objects[i]));
    if ExitNow
    then exit;
    end;
    end;

    procedure IncludeSubReports(R: TppReport);
    var
    NumBands: integer;
    i: integer;
    begin
    NumBands:=R.BandCount;
    for i:=0 to NumBands-1 do
    begin
    LookAtBands(R.Bands[i]);
    if ExitNow
    then exit;
    end;
    end;

    begin
    CodeText:=#10#13+
    'Report: '+DMReport.RepTblName.AsString+#10#13+
    'File:
    '+Ini.ReportPath+trim(DMReport.RepTblFileName.Value)+'.rtm'#10#13+
    '----------------------------------------------'#10#13;
    // BUILD THE RTF
    Screen.Cursor:=crHourglass;
    try
    ExitNow:=false;
    IncludeReport('Main',TppCustomReport(DMReport.Report));
    if ExitNow
    then exit;
    IncludeSubReports(DMReport.Report);
    if ExitNow
    then exit;
    finally
    Screen.Cursor:=crDefault;
    end;


    .....
    print the CodeText string


    end;



  • edited April 2004
    Joseph,
    Thanks! I am going to try to get your approach to work. I'll let you know
    how it goes.
    Thanks again,
    Les


This discussion has been closed.