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

drill down different subreports depending on variable

edited April 2006 in Subreports
I have a report with a list of transaction lines. I want to have a drill
down to sub report but depending on what type of transaction it is I need to
drill down to any one of several subreports. how can I select which
subreport should be shown?

Comments

  • edited May 2006
    Hi Paul,

    You can use the TppSubreport.ExpandAll property to individually expand
    specific data at run time. Setting this property to True will expand the
    given subreport.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2006
    but does this not expand everything? What I want to do is depending on the
    detail data choose one sub report or another. I've managed to do this one
    way by adding two label fields that are linked to each of the subreports and
    become the drilldowncomponent of that. I then overlay the two labels
    together and hide one or the other depending on the data. I'd prefer to have
    the abilty to set it dynamically as I may have several different subreports
    to display.

  • edited May 2006
    Hi Paul,

    Sorry for the delay in this response. My newsreader somehow lost track of
    your reply.

    The ExpandAll property will only affect the detail bands below the current
    on being generated. This allows you to set its value as the report is
    generated. Adding the following code to the sbrOrder.DetailBand.BeforePrint
    will give you similar to the effect you are after.

    procedure Tfrm0152.ppDetailBand1BeforePrint(Sender: TObject);
    begin
    if ppChildReport1.DataPipeline['ItemsTotal'] < 1000 then
    sbrItem.ExpandAll := True
    else
    sbrItem.ExpandAll := False;
    end;

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2006
    I don't think you understand correctly - I am not looking to expand all
    subreports. I want to display either Subreport A on a drilldown where my
    master field = Value1 or a totally different Subreport B where the master
    field = Value 2. It can be achieved by linking each subreport to a different
    drilldowncomponent so as you click either it opens up the appropriate sub
    report. howeve these have to be mutually exclusive so the user should not
    be able to load both simultaneously as the sub-reports depend on a key value
    in the master record.

    e.g.
    Transaction no Type Ref
    =========================
    1 Invoice xxxx
    2 Credit yyyyy

    If my drilldown component is the transaction no then clicking on 1 should
    drop down a sub report on the invoice details whereas clicking on 2 should
    drop down a sub report with a payments listing.


  • edited May 2006
    Hi Paul,

    Sorry for the delay.

    If I understand correctly, you are dynamically switching which subreport is
    shown when the label is clicked based on some user input? Is there ever a
    case where both subreports will be available at the same time? If not, you
    sould be able to dynamically load each subreport and create the drill-down
    component when the report is generated. This would consist of storing a
    number of report templates and loading them into a single subreport object
    as you need them.

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