Home General

dynamic filling of grids in subreport multiple use

edited February 2016 in General
I am working on a report which will present a collection of summaries.
Each summary will have a group header in which I present the summary
name. In the detail is another subreport, which in turn contains a grid
row for header captions, and a grid for detail rows. The headers grid
is in the title band, and the details grid is in the detail band.

All data comes from a single dataset, but I need to present only some
of the columns in each summary, and the particular subset of columns
varies with the summary. Moreover, the user can select options to show
or not show types of columns.

My question is this: Can I use a single subreport for this, and set the
column count and fill the cells with TppDBText controls in an event
handler?

I have been exploring the event handlers at the various levels, and it
is not obvious to me how best to achieve this result.

Thanks!

Bill Meyer

Comments

  • edited February 2016
    Hi Bill,

    An ideal solution would be to create a separate query for each "summary"
    and connect those queries to separate subreports so ReportBuilder does
    the work of populating your grid(s).

    Even though all the data is inside a single dataset, there is no need to
    have only a single query accessing that data.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2016
    Nico Cizik (Digital Metaphors) wrote:


    Thanks, Nico. Not sure I understand fully your suggestion.

    Are you saying that I would have a separate subreport for each
    variation, each with its own layout? Or that I would have a single
    subreport design, with multiple instances, and each populated from its
    own query?

    None of this is done, at present, with live data, and it would not be
    easy to alter that.

    I guess my thought is, if I have a separate subreport for each summary,
    then I can apply all the differences in the before print, so I'm not
    sure what a query adds to the value.

    Do you have an example of the approach you are suggesting?

    Thanks,

    Bill Meyer
  • edited February 2016
    Hi Bill,

    I apologize, after re-reading your post, I think I misunderstood your
    original design/requirements.

    If I understand correctly you are using a ppTableGrid component in your
    subreport and would like to show/hide certain columns of that grid for
    each iteration of the subreport. I also assume you have a master-detail
    data relationship.

    You should be able to use the Band.BeforePrint event of the main report
    to alter the contents of the TableGrid inside the subreport before it
    prints. From there you can set the visibility of each column as you
    need and also set the visibility of each cell contents as well based on
    the master record.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2016
    Nico Cizik (Digital Metaphors) wrote:


    Nico,

    Thanks! That makes more sense. I have a subreport in which I have a
    ppDBText component and a ppTableGrid in the title band. The name of the
    Summary will go in the ppDBText, and the column header captions in the
    one-row grid.

    In the detail band, I have another ppTableGrid, which will be filled by
    the detail rows.

    So yes, I have master (summaries) and detail (details) datasets.

    I have two other questions. First, I have not succeeded in keeping the
    subreport from breaking on pages, even when small. For example, in one
    case, a summary has the ppDBText, the headers grid and the details
    grid, and there is only one row in each grid, but the ppDBText appears
    on the bottom of a page, and the grid rows on the next page.

    Second, in the case where I have too many details to fit on one page,
    how do I get the ppDBText and the header captions grid to repeat on the
    subsequent page(s)?

    If this is not clear, let me know, and I can e-mail a PDF with the
    issues in evidence.

    Thanks,

    Bill Meyer
  • edited February 2016
    Hi Bill,

    Which version of ReportBuilder and Delphi are you using?

    I assume you have keeptogether set to True for the subreport? If this
    is the case, are you able to recreate this behavior with a simple example?

    You could use a group header instead of the title band with reprint on
    subsequent pages set to True to get the header info on each page. Also
    the TableGrid now supports header rows which will reprint on each page.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2016
    Nico Cizik (Digital Metaphors) wrote:


    Nico,

    Thanks. We are on RB15.02. I am guessing that we need a later version
    for these behaviors, as I have not found in this version any support
    for hiding columns.

    I doubt I can create a simple example to demonstrate the problems. At
    least, not without suspending my normal work, which I cannot do at the
    moment.

    Can you please tell me which of these things can be done in 15.02? If
    necessary, I will put in a request for update, but that must go through
    corporate purchasing, and if I am lucky, will add at least a couple of
    months.

    Thanks,

    Bill
  • edited February 2016
    Nico Cizik (Digital Metaphors) wrote:


    Nico,

    From what I can see, it would seem that in the Band.BeforePrint, I
    would need to:
    - remove components from cells not wanted
    - remove or columns, as required
    - put new components in added columns

    It seems pretty involved.

    Another possibility occurred to me, and I would like to know if it is a
    possible solution.

    I could use cloned cursors in my ClientDatasets to facilitate the
    presentation of data in multiple instances of subreports. In that way,
    I would prepare each needed subreport with the columns required, rather
    than dynamically altering a single subreport. The downside would be the
    need for a pipelint and datasource for each subreport.

    Is that a viable solution?

    Thanks,

    Bill
  • edited February 2016
    Hi Bill,

    All updates and changes can be found in our release notes posted on our
    website. Bug fixes can be found in our announcement posts and in the
    Announcements newsgroup.

    http://www.digital-metaphors.com/rbWiki/General/What's_New

    To answer your question. The ability to show/hide columns in a TableGrid
    was added for RB 17. Likewise, the ability to reprint a TableGrid header
    row on each page was also added for RB 17.

    We have also made numerous fixes dealing with engine keeptogether issues
    since RB 15 however you would need to test your specific case with the
    latest version to be sure it has been addressed.

    I highly suggest you consider upgrading ReportBuilder to the latest version
    with a yearly subscription. Doing so will give you one year of minor and
    major RB releases with the ability to renew your subscription at a lower
    price up to 30 days after the existing one expires. Many of our customers
    in your position requested that we move to a subscription model in order to
    avoid constantly requesting approval for a new product purchase.

    http://digital-metaphors.com/order/


    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.