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

error when printing a report loaded from template

edited July 2003 in End User
In my app certain users can use the report explorer to design and view/print
reports as usual. I also have a button with a drop-down menu accessible to
all users that displays the reports available. Selecting one of the reports
in the menu prints the report directly. This works fine for simple reports
such as lists. However, more complicated reports with calculations (e.g.
variables in the footer) print from the report explorer but throw a "compile
error" - typically "footer before print" when launched the other way. I am
using the LoadFromTemplate property and, as I say, this works great for
non-complicated reports. Do you have any suggestions as to why this could be
happening?


Regards

Mike Combellack
Software Experts S.L.

Comments

  • edited July 2003
    RAP isn't compiling. Can you reproduce this error on a test deployment
    machine? Perhaps your deployment exe doesn't include some RAP pass through
    functions that you are using in your development app? Where are you calling
    LoadFromTemplate? Do you mean the SaveAsTemplate property? When you load
    from the report explorer visually, as an end user, the report template is
    loaded automatically from the database. When the report runs with RAP code
    and SaveAsTemplate is true, then it streams the template to file instead of
    to the form at runtime so that your RAP code won't overwrite the layout
    settings when you return to the design workspace (Design tab) after
    previewing.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited July 2003
    Thanks for reply. Yes, this error happens on the development machine too.
    Perhaps I'm not using LoadFromTemplate correctly.... When the user selects a
    report from a menu to print, the ID for that report is noted - I use the
    ITEMID from the table used for the report definition (the same as the one
    used by the Report Explorer). I then locate that record and call
    LoadFromTemplate, which I thought loaded the TEMPLATE field contents from
    the ITEMS table into the report variable.... which I then try and print. As
    I said before, this seems to work for reports with no variables, so I
    assumed I was doing it correctly! Please correct me.....

    Mike Combellack


  • edited July 2003
    Try calling Report.Template.LoadFromDatabase as this uses the
    Report.Template.Datasettings property configuration to find the report from
    the data pipeline. The pipeline should be the rbItems pipeline which is the
    same one used to return items for the report explorer component. That should
    work for you as you can examine the Report.Template.Datasettings at runtime
    by code to be sure that it is set correctly to give you the report you want.
    This property is listed in the help file too under the TppReportTemplate
    class properties.


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.