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

Rule for generating detail

edited March 2006 in General
Hi,

Is there any way for me to determine if a specific record prints in a
detail Band?
Explaining: I have a detail band with 3 values (Name, Amount1 and Amount2)
and I want to the report only show the lines where amount1 and amount2 are
<> 0.

[]'s
Ricardo

Comments

  • edited March 2006
    Inside the OnBeforePrint event of the DetailBand, you can check the values
    of the fields about to print and set their visibility accordingly.

    var
    lbZero: Boolean;
    begin

    lbZero := (ppReport.DataPipeline['Amount1'] = 0) and
    (ppReport.DataPipeline['Amount2'] = 0);

    dbText1.Visible := lbZero;
    dbText2.Visible := lbZero;

    end;
    --
    Regards,

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

    Best Regards,

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

    Use the same logic that Nico laid out, but instead of toggling the object
    visibility, toggle the visibility of the band (i.e., Detail.Visible :=
    lbZero;)

    --

    Bob

  • edited March 2006
    You will need to set the visibility of the group header and footer bands as
    well.

    --
    Regards,

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

    Best Regards,

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

    As Nico notes, it is a similar strategy for group footer/header, but with
    one wrinkle. You will need to use two DBCalc objects in the group header
    with the Look Ahead option set.

    --

    Bob

  • edited March 2006
    But the other DBText will still be visible, wich could be solved with one
    more line of code.
    I think I didn't make myself clear. I don't want to the whole line to be
    generated and (if no lines were generated, then all groups should be
    invisible. like this:

    In the following case I have 2 groups (date and user)

    01/02/2006
    User 1
    money $10,00 $3,00
    check $60,00 $18,00
    User 2
    money $20,00 $3,00
    check $0,00 $0,00 <- this whole line shouldn't be
    generated

    02/02/2006
    User 1 | <- none of the following 3
    lines should be generated
    money $0,00 $0,00 |
    check $0,00 $0,00 |
    User 2
    money $10,00 $3,00
    check $60,00 $18,00

    03/02/2006 | <- none of the following 7
    lines should be generated
    User 1 |
    money $0,00 $0,00 |
    check $0,00 $0,00 |
    User 2 |
    money $0,00 $0,00 |
    check $0,00 $0,00 |

    Sorry if I didn't make myself clear before and thank you

    Ricardo

  • edited March 2006
    Hi Bob,

    Thank you for the tip. I didn't even try this cus I thought it would make
    every line invisible.
    But still not 100%, is is still showing group header and footer even if no
    line is rendered.

    Thanks
    Ricardo

This discussion has been closed.