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

Error with raCodeModule1

edited January 2004 in End User
We have a user that is attempting to import a .ctm file. The customer is
receiving an "A component named raCodeModule1 already exists. Ignore the
error and continue?" error.

We are using version 6.03 of RBP for Delphi 6 (all service packs applied for
Delphi). This used to work with version 5.0 of RBP for Delphi 5 (all service
packs applied for Delphi). Attached is the ctm file. Any ideas on how to fix
this? I'm not 100% sure if the reports were created brand new or were 5.0
upgraded ones (probably the latter). I do believe the ctm file was imported
using 6.03 and imported using 6.03 instead of importing a 5.0 exported ctm
file.

Thanks.

SMP

Comments

  • edited January 2004

    Try downloading a trial version of RB 7 for D6 and perform the same test.


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

    Best regards,

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

    I tested this here using RB 7 and it appeared to work without error.

    If you still have an issue in RB 7, create a simple example and e-mail in
    zip format to support@digital-metaphors.com.


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

    Best regards,

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

    We are using RB6. Do you have RB6 available to test? If not, I will check
    and see if an upgrade to RB7 is a viable option. Our fear with upgrading is
    that we have 1000's of customers and we don't want to fall on our faces by
    going to a new version.

    Thanks.

    Steve

  • edited January 2004

    I installed RB 6.03 and performed the same test and got the same result.

    Perhaps you should create a more complete test case for me. You only sent to
    me the code module file (.ctm) so when I import the code module I receive
    error messages stating that the Variable57 is not found, etc. Which is
    correct, I do not have a report layout with the Variable57. I choose to
    ignore the errors and the module imports. I do not receive any errors about
    raCodeModule1.


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

    Best regards,

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

    Thanks for the update.

    However, I am surprised the 6.03 export works for you.

    Maybe I have something wrong with my code but if you review the attached
    Word document, you will see that there are differences between the two CTM
    files (one from 5.0 and one from 6.03). If I export code from 5.0, add the
    variable to a report in 6.03, and import the 5.0 ctm file in 6.03,
    everything works great. However, if I export the 6.03 code to a ctm file and
    import it, I get the error that the TraCodeModule1 component is already
    there. As you can see from the attached screen print, the 6.03 ctm file
    contains a line that says "raCodeModule1". Reviewing the 5.0 ctm file, there
    is no such verbage. Why are there differences?
    Since you said it works for you, can you attach a ctm file so I can take a
    look at it and compare it to mine? Is there a property that I could have set
    to save the ctm file differently? I thought I saw another user that had the
    same problem but I can no longer find the post that describes it.

    I understand that the ctm file is binary but is it possible for me to write
    a program that will setup the "header" of the 6.03 exported ctm file
    properly so it can be imported back in? Specifically setup the top of the
    ctm file to match the 5.03's ctm file that works when exported into a 6.03
    report. I don't think it would be a problem for our customers to have to
    resave the ctm file in a separate application prior to importing the ctm
    file.

    Also, I think I know the answer, but if we upgrade to RBP 7, will we be able
    to create reports in RBP7 and open them in a RBP 6.03 version. I don't think
    so, just asking.

    Steve
  • edited January 2004
    Nard,

    Just for kicks, I opened the 6.03 rap.dpr project in C:\Program
    Files\Borland\Delphi 6\RBuilder\Demos\0. RAP\1. Main. I opened the first
    report in calculations "Retrieve Field Value" by double-clicking the item in
    the TreeView. I clicked the Calc tab and exported the code. The ctm file is
    totally different then the any ctm file exported from our app so it appears
    there are properties for either the report or designer. I did attempt to
    import the ctm file in the demo report and received the same error: "A
    component named raCodeModule1 already exists." and it wants to open
    ppTmplat.pas. If I select "Ignore All", I receive an AV.

    Attached is the ctm file.

    What am I doing wrong?

    Thanks.

    Steve
  • edited January 2004
    Nard,

    Some more information:

    1. I compared the 5.0 and 6.03 ctm files. You can see the differences below
    for the first demo report mentioned above. If I import the 5.0 ctm file into
    6.03, it works great. It looks like "raCodeModule1:" is the issue.

    5.0

    object TraCodeModule
    ProgramStream = {
    01060F5472614576656E7448616E646C65720B50726F6772616D4E616D65060F
    5661726961626C65314F6E43616C630B50726F6772616D54797065070B747450
    726F63656475726506536F75726365066370726F636564757265205661726961
    626C65314F6E43616C63287661722056616C75653A2056617269616E74293B0D
    0A626567696E0D0A0D0A202056616C7565203A3D20706C53746F636B5B274375
    725F5072696365275D3B0D0A0D0A656E643B0D0A0D436F6D706F6E656E744E61
    6D6506095661726961626C6531094576656E744E616D6506064F6E43616C6307
    4576656E74494402210000}
    end

    6.03

    object raCodeModule1: TraCodeModule
    ProgramStream = {
    01060F5472614576656E7448616E646C65720B50726F6772616D4E616D65060F
    5661726961626C65314F6E43616C630B50726F6772616D54797065070B747450
    726F63656475726506536F75726365066370726F636564757265205661726961
    626C65314F6E43616C63287661722056616C75653A2056617269616E74293B0D
    0A626567696E0D0A0D0A202056616C7565203A3D20706C53746F636B5B274375
    725F5072696365275D3B0D0A0D0A656E643B0D0A0D436F6D706F6E656E744E61
    6D6506095661726961626C6531094576656E744E616D6506064F6E43616C6307
    4576656E74494402210000}
    end

    2. If I save a report in binary (all my reports are currently saved in
    binary), can I open it in binary and switch it to ASCII and save it again?
    Do I need to set the template.format in the same format the report is saved
    PRIOR to opening it? For example, if all of my reports are saved in binary,
    do I need to set the template.format to binary, open the binary reports,
    switch to ASCII, resave the report, and set a switch for each ASCII-saved
    report so the next time the ASCII-saved report is opened, I would set the
    template.format to ASCII?

    Thanks.

    Steve
  • edited January 2004

    1. I was able to recreate the error and have created a patch for RB 7.03.

    2. Starting with RB 6, the TraCodeModule was assigned a name. Thus the
    difference in the .ctm files.

    3. For report loading, RB can automatically detect whether the report is
    binary and ascii and load it. For report saving you need to set
    Report.Template.Format.

    4. Here is an example of loading reports reports and editing them as text:

    http://www.digital-metaphors.com/tips/EditTemplatesAsText.zip




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

    Best regards,

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