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

Add Code to each Record in a DataPipeline

edited July 2004 in General
I'm developing a report that needs a field added to a secomd line in the
detail band if a certain ondition exists, but only one line if that
condition doesn't exist. My question: what event on what object (detail
band of the report, dataset, datasource, pipeline, etc.) in Report
Builder will let my program look at each record one by one in the report
and evaluate the condition? I have tried most logical objects and
events with no success. Thanks in advance.

Thank You!
Gerry Tomlin
gktomlin@verizon.net

Comments

  • edited July 2004
    Hi Gerry,

    Try using the DetailBand.Before Print. From there you can check the value
    of the current record or check the value of a condition set and change the
    contents of the Detail Band before it is printed.

    --
    Thanks for supporting ReportBuilder! Please vote for ReportBuilder in the
    Delphi Informant Readers Choice awards!

    http://www.delphizine.com/ballot2004/

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2004
    Nico Cizik (Digital Metaphors) wrote:
    I will try that, but it seems to me I have already done so. Here is the
    problem: I want to show the value of a field on a second line in the
    detail band if a certain condition exists, but only show one line if the
    condition does not exist. Should I use phStatic and set the detail band
    height to a different value (or use phDynamic) as well as making the
    field's visible property true or false according to the condition?
    Sorry, that was a complicated question.

    Thanks for the help!
    Gerry Tomlin
    gktomlin@verizon.net
  • edited July 2004
    Hi Gerry,

    I would use a dynamic detail band and toggle the visibility of the line
    according to the condition. This is pretty much the standard way to do this
    in ReportBuilder.

    --
    Thanks for supporting ReportBuilder! Please vote for ReportBuilder in the
    Delphi Informant Readers Choice awards!

    http://www.delphizine.com/ballot2004/

    Best Regards,

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

    Would you use a 2 line band and toggle the visibility of the second line?

    Thenks!
    Gerry Tomlin
    gktomlin@verizon.net
  • edited July 2004
    Yes, that's how I would do it :).

    --
    Thanks for supporting ReportBuilder! Please vote for ReportBuilder in the
    Delphi Informant Readers Choice awards!

    http://www.delphizine.com/ballot2004/

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2004
    Nico Cizik (Digital Metaphors) wrote:
    Is there a way to address each line of a detail band?
  • edited July 2004
    Hi Gerry,

    The Bands in ReportBuilder are not split into "lines" as in lines of text.
    Each band acts as a drawing canvas in which items can be placed and
    manuvered to any position you like. If you would like to control the
    visibility of a number of components, try placing a TppRegion on your report
    and then placing all the given report components inside the region. Then
    you can toggle the visibility of the region instead of toggling the
    visibility of each individual component.

    --
    Thanks for supporting ReportBuilder! Please vote for ReportBuilder in the
    Delphi Informant Readers Choice awards!

    http://www.delphizine.com/ballot2004/

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2004
    Nico Cizik (Digital Metaphors) wrote:
    Thanks Nico for your suggestion about regions! I'm having a problem
    printing either 1 or 2 bands in a detailband as determined by condition
    A. I have tried 2 approaches with some success, but not good enough for
    my application. I'm printing a receipt for a Point of Sale application.
    The detail band lists all items purchased in the first band. If there
    is a discount on an item a second band in that record would show the
    savings. Condition A evaluates whether there is a discount.

    The first approach, and the one recommended by you, is to use the
    BeforePrint event. When I do I find the number of lines printed to be
    determined only by the last record. For example, assume there are 3
    records and only the second meets condition A for 2 lines. The first
    and last record should have only one line. The report prints with only
    1 line for all 3. How can I control the number of bands for each
    individual record?

    The second approach I have tried is to use a Variable object to evaluate
    condition A for each record. This works great, but there seems to be no
    way to determine which band is printing and so I cannot control the
    visibility of the objects. BandsPerRecordCount is a read only property.

    I really appreciate all of your help!

    Gerry Tomlin
    gktomlin@verizon.net
This discussion has been closed.