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

Auto Search in Homegrown Viewer Form

edited February 2009 in General
We have an application form that lists all the templates from the database
(rbItems) and from the file system (*.rtm files). When the user selects a
template from either list, we display the report in a ppViewer component,
which has been placed on a form to allow users to preview and print a report
(no report designer interaction).

Given that the report "auto search smarts" are embedded in the template, is
it possible to
integrate an auto-search into the above mentioned homegrown preview form?

We want to replicate a similar behavior to pressing the Search button on the
Preview tab in the Report Designer ... in our homegrown solution we want to
display the AutoSearch dialog when the user selects a toolbar button ...
then apply the AutoSearch rules to the Report when the user closes the
AutoSearch dialog (ModalResult = MROK).

Thanks, Patrick

Comments

  • edited February 2009
    Patrick,

    You posted this question in a prior thread on Friday. Please give us the
    opportunity to reply to the question, before giving up and starting a new
    thread. :)

    1. You might consider using the standard ReportExplorer included with RB. It
    provides the ability for the users to browse the reports and preview/print
    etc. You can use the ReportExplore FolderOptions and ItemOptions to control
    whether the user can create/modify reports. The ReportExplorer also stores
    the reports to a database, when can be a good way to keep everything
    organized.

    2. For your custom solution, consider using the TppPreview class rather than
    TppViewer. The TppPreview class is a non-visual class used by the RB preview
    form and the report designer. TppPreview internally creates and manages the
    UI controls associated with the preview. These controls include the toolbar,
    viewer, outline, text search, and autosearch. For an example, see
    RBuilder\Source\ppPrvDlg.pas.

    For your custom solution you can place the a Panel on the Form and then pass
    the panel to the TppPreview constructor.

    3. If you don't want to do either of the options above, then you can just
    use button and call Viewer.DisplayAutoSearchDialog from the OnClick

    If you want to take more control than that, then check out the source code
    to the Viewer.DisplayAutoSearchDialog method. And also the source to
    TppPreview. I think the source to those classes might help you implement
    features for your custom solution


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited February 2009
    Nard,

    Sorry ... and thanks. We expose the ReportExplorer in the application, but
    the homegrown Viewer form gives our users the flexibility to see reports
    that are stored in the database (report explorer) as well as templates
    stored on the file system ... kind of a one stop shop for report previewing
    and printing.

    With some experimenting, I've gotten the AutoSearch dialog to appear by
    calling the ppReport.DisplayAutoSearchDialog when the user clicks the
    toolbar button ... this is good.

    When the AutoSearch dialog closes, the new criteria (ex: Date range) does
    not take effect in the Viewer until I change the current page (navigator
    arrow buttons on the toolbar).

    So it looks like I've got the basics of what I need, however, I can't find a
    way to "refresh" the report when the AutoSearch dialog closes that would
    force the new criteria without using the navigation buttons to change report
    pages.

    Does this make sense?

    Once again, thanks... Patrick

  • edited February 2009
    Nard,

    Once again, thanks for your help. We are juggling Delphi, DevEx and RB all
    at the same time and trying to meet a deliverable date (what's new, right?).

    I think I found my answer. In the ppReportAutoSearchDialogClose Event, I
    use

    ppViewer.Report.PrintToDevices;

    which takes care of the "refresh after auto search" issue. Do you think
    this is an appropriate solution?

    Patrick

  • edited February 2009

    In my last post I recommended calling Viewer.DisplayAutoSearchDialog. That
    takes care of regenerating the report. :)

    Check out the Viewer source code, if you wanted to implement that feature in
    some custom code. :)


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

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