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

Executing report in ReportExplorer without showing it...

edited June 2003 in End User
Hi,
I would like to execute PrintPreview method of the custom ReportExplorer
form on button click without showing the form itself. The reason for it is
because I have my code inside PrintPreview method and also because all my
settings are already set.
So the question is: How do I execute a certain report without showing
ReportExplorer form?

My guess is that I must set focus on the report I want to print and call
PrintPreview method, or I could pass database Item_Id value to somewhere for
execution...

Thanks,
MB

Comments

  • edited June 2003
    Also, it seems that I can't call a method of the report explorer without
    creating it first.
    But calling to the TppReportExplorer.Execute method creates and SHOWS the
    dialog.
    Can't I create the instance of the TppReportExplorer without showing it?

    Thanks,
    MB.

  • edited June 2003
    One more thing.
    Your "Tech Tip: How to Programmatically Load Reports that were Saved using
    the Report Explorer"
    doesn't work either unless Report Explorer is instantiated. (At lest 1st
    method).
    The question is still the same: How to instantiate Report Explorer without
    showing it (in background).

    Thanks,
    MB.


  • edited June 2003
    Waht do you want to do? If you know the report you want, simply load it from
    database (Report.Template.LoadFromDatabase). Then access the other field in
    the dataset that you want, ie ItemID, and then call Report.Print and then do
    what you want with the ItemID or update a field saying that you've printed
    this report. You can always fire a query to get an rbItem record from the
    database table if you want the other fields rather than just the template
    BLOB field. I would lean towards trying to load the template from database
    and perform your other code in a new way, instead of trying to rely on the
    code already in place inside your report explorer related code.

    The report explorer is not meant to be used behind the scenes like that, and
    no one has tried this before. It won't work because the Initialize method is
    called in BeforeShowForm, and the report explorer needs to be initialized.
    So, one option is to change the interface to the report explorer so that you
    can use it without calling the intended Execute method. This isn't
    recommended, but it is an option.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited June 2003
    Thank you for the explanation.
    I guess I'll stick to the LoadFromDatabase method.

    One more question:
    But if I have several reports with same names in different folders, then do
    I have to use ppReport1.Template.OnLocateRecord event? Or can I somehow
    bypass it? And if not could you please give me a small example on using this
    event?

    Thanks,
    MB.

  • edited July 2003
    Sorry for the delay, I was out of town for a few days. The only way to
    programatically find a report by name is to also search on FolderID in order
    to be sure you find the report. This is done visually when the user selects
    a folder and report in the report explorer interface. These two fields are
    used together to find the correct report, since FolderID is a foreign key in
    the rbItems table.


    Cheers,

    Jim Bennett
    Digital Metaphors


    do
    this
This discussion has been closed.