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

Calling Enduser report from somewhere else.

edited February 2006 in End User
I have an end-user report I've written in the end-user program. I now would
like to call that report from outside of the end-user program. ie: Call
the report, pass it a few parameters and have it run itself without the user
having to open the program and manually select the report. Is this
possible?

Thanks,

glenn

Comments

  • edited February 2006
    Hi Glenn,

    Yes, this is definitely possible. Where are you storing your report files?
    If they are stored in a database blob field, you can use the
    Report.Template.DatabaseSettings property to retrieve the proper file. If
    the report is saved to your hard disk, you can use the
    Report.Template.FileName property to retrieve it. Take a look at the
    Template property in the RBHelp file for more information.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2006
    Hi Glenn,

    For future reference, please use your real name when posting to these
    newsgroups. See the newsgroup guidelines located at the following page.
    http://www.digital-metaphors.com/support/newsgroups.html

    Take a look at the following article on retrieving reports from the explorer
    in code...

    ---------------------------------------------------------------
    Tech Tip: How to Programmatically Load Reports that were Saved
    using the Report Explorer
    ---------------------------------------------------------------

    1. The ReportExplorer has a run-time interface you can use to load
    reports using the ReportExplorer.LoadReport method. You can use this
    method without actually 'showing' the report explorer form. (See the
    online help topic for TppReportExplorer.)

    2. If you want use Report.Template.LoadFromDatabase, RB will locate the
    report stored in the database table based upon the NameField value only.
    However, for the rb_item table you really need Folder_Id, Name to locate
    a record uniquely.

    To override this default behavior, you can assign an event-handler to
    the Report.Template.OnLocateRecord event.

    example:

    TmyForm = class(TForm)
    private
    function ReportLocateRecordEvent(Sender: TObject; const
    aReportName: String): Boolean;

    end;

    procedure TmyForm.FormCreate(Sender, TObject);
    begin
    {assign the event handler}
    FReport.Template.OnLocateRecord := ReportLocateRecordEvent;

    end;


    function TmyForm.ReportLocateRecordEvent(Sender: TObject; const
    aReportName: String): Boolean;
    begin
    {add logic here to locate the record and return True if it is found}

    Result := myLocateReportFunction(FFolderid, aReportname);

    end;

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2006
    Nico,

    I apologize if my handle for this forum is not my name but I am hundreds of
    different forums and 95% of the time I try to use my name I am rejected and
    have since just resorted to using this name as its always available. I
    always post my name in my posts though as I'm not trying to hide. But you
    guys don't know my name any more than cybercrypt so not real clear on the
    problem...

    Also, thanks for the info you provided. I'm looking into this stuff now as
    this enduser reporting stuff is new to me...

    glenn


  • edited February 2006
    DM et al,

    I think there is merit in an example of this in the Demos area.

    I too had been dwelling on this particular subject. I see the
    'enduser' application as something the administrator or similar would
    use to develop/define reports that were subsequently called and used by
    other applications.

    By way of example, as part of an application package, I distribute the
    core application which provides various reports, let's say for example
    one of them is an Invoice for a specific job. On this report are the
    Company, Customer, Job & items details relevant to the specific job.
    Currently this invoice is defined as a basic Invoice report template
    that is also distributed with the application. The administrator then
    uses the 'enduser' tool to customise the report/template to their
    business specific requirements, however the same report is still called
    by the end user application.

    Rather than distributing templates it would be great to have them all,
    Invoices, packing slips, receipts, orders, etc, contained in the
    ReportExplorer environment as a central repository, after all
    everything is already defined in the various rbxxxx datafiles, and the
    application simply calls/runs the report, with any relevant parameters,
    from the ReportExplorer. I suspect for integrity the DataDictionary
    would need to be included.

    I think this would be an excellent addition to the demos and greatly
    enhances the flixability of RB.

    My 2 cents worth.

    On a separate but related subject.

    Given that the DataDictionary can be fairly heavily detailed for the
    environment, is/has there been any thought to this being enhanced to
    allow its use by an application in general rather than just for RB?



    Regards,

    Ian



    --
  • edited February 2006
    Hi Ian,

    Thanks for the feedback.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.