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

Need to change tables for std reports

edited September 2003 in End User
Hi,

I just upgraded to pro and am trying to get a handle on the enduser stuff.

I'm using RB7Pro and Advantage and Delphi6.

I have standard reports that we need to run based on different tables. The
layout of the tables are always the same. I've been able to do this by
deleting the original table and then adding the new table. I have to fix all
report variables. Kind of tough to ask end-users to do that each time.

Also, the reports will be the same except for the main heading of the
report. Is there a way to prompt for value at point of previewing the
report.

Thanks,
John Panagia

Comments

  • edited September 2003
    Hi John,

    Thanks for upgrading! Is the report template the exact same layout? If the
    code for the variables has to change, then all you may need to do is to use
    different report templates. That way the different report variables can hook
    into their own Delphi event handlers when the template is loaded. Each
    report can also hook up to a unique data pipeline which has the table
    dataset that you wan to gove to that user.

    As far as replacing the tables, what do you mean exactly? There are a few
    ways to go about this depending on if you are using datapipeline components
    on a form or using DADE. Have you explored the Autosearch feature of RB? Are
    you using DADE (the Data tab) now that you have the Pro Edition? Are you
    replacing the datamodule on the report? There is the Import, Export and
    Merge menu options to do this as an end user. If you want to do this in
    code, then here is an example:
    http://www.digital-metaphors.com/tips/ReplaceDataModule.zip

    If you want to show custom information in the title and asking the user is
    the only way to find out, then you can create and show a simple form
    yourself in the Report.BeforePrint event.

    Are you using the Report Explorer? You may soon find that RAP is going to
    solve many problems when you start trying to deal with Delphi event
    handlers, loading event handler name collisions and basically trying to deal
    with a lot of event handlers on the form unit that the report explorer is
    on. Using RAP allows you to code the event handlers inside the report
    template so all the code is localized inside a template and is easier to
    manage once there are many reports and lots of code for them involved.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited September 2003
    Jim,

    I'm looking for a solution for end-users. The report is identical. I've use
    Dade to set up an initial dataset. In this case it is NyMaster.dbf using the
    advantage dade setup. I did this from the data tab. In the future I would
    like to use this report with CaMaster.dbf or WyMaster.dbf and so on. The dbf
    files will always have the same field structure.

    I'm not at all sure what a template does or how they used. Is there a demo
    illustrating them?

    Thanks



  • edited September 2003
    Hi John,

    For which cases do you want to change the database? If you want to design
    the report with X database and for deployment change it to N databse or Y
    database only once, then that is possible.

    The report template saves the report definition along with the data access
    (DADE) definition. You can set the Report.Template.Format to ascii and see
    the text in a report template when you save to file with a DADE dataview.
    You'll see that it saves the data access component you used to find the
    database. The database name is stored in the template. What you can do is at
    runtime change this database name and if it exists on the database it should
    allow you to switch between databases.You'll have to load eac report
    template from the databse or file and convert the DatabaseName entry in the
    file as ascii text. Then you can save it and the user will use that database
    when they run the report. You'll have to perform this operation before the
    report is loaded by the user. You can load a report template from binary
    without using a report object as shown in this example:

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

    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.