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

Dynamically Set Sub-Report Dataview Query

edited July 2006 in Subreports
Hi,

In a report with a drill-down sub-report that has a dataview not linked to
the dataview of the main report (not possible for performance reasons), I
would like to set the search criteria for the sub-report dataview when the
drill-down is initiated by the user. Is there an event that will allow me
to do this using something like SQLBuilder or CreateAutoSearchCriteria?


--

Bob

Comments

  • edited July 2006
    Hi Bob,

    Once you define a drill down component, the OnDrawCommandClick event is
    ignored. This would be the event you would want to use to add the search
    criteria. One workaround is to manually take control of the drill down
    feature. Take a look at the following example that shows how to do this.

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

    --
    Regards,

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

    Best Regards,

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

    Thanks for the pointer on the drill-down example, I will check it out.

    Just to clarify what you are saying, for a sub-report that is not a
    drill-down, I can use the OnDrawCommandClick event and the
    CreateAutoSearchCriteria method will work to add a new criteria. Do I have
    this correct? Can I also use the SQLBuilder methods from this event?

    If the sub-report is in a detail band and the CreateAutoSearchCriteria
    aExpression is specified as a data field from the main report dataview
    (e.g., MainDataview['CustNo']), does this pick up the value from the band
    where the user clicks or am I just wishing out loud?

    --

    Bob

  • edited July 2006
    Nico,

    I had a look at the example you mentioned and unless I am missing something,
    this does nothing to control the sub-report query.

    Assuming that I am missing something, can you list the RAP code and the
    event I should be using to modify the query.

    --

    Bob

  • edited July 2006
    Hi Bob,

    The example simple gives you control over an event that fires when you click
    on the drilldown component. From that point it is up to you to add search
    criteria and regenerate the report if needed. I would suggest initially
    coding this in Delphi, then moving the code to RAP. This can give you a
    good idea what can be natively done in RAP and what will need to be placed
    in a pass thru function.

    --
    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.