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

Suppress Fields with No Values

edited January 2006 in End User
I'm using RB 7 with Delphi 5. I have a end user report that contains a
subreport. This subreport has two fields stacked one on top of another.
What I want is for each of these fields to show only if they have values.
So if the first field does not have a value, then the field on the bottom
will show on the top line. In my report the first line in the subreport is
a person name and the second line is a business name. In some situations
there will be no person name, only a business name

Here is an example of the detail section format I would like to see (where
the subreport is under the names column):

Example with Name and Business
Reference No: Names: Date:
--------------- ------------------ ---------------
10001-1 John Doe 12/22/2005
ABC Corporation

Example with Name Only
Reference No: Names: Date:
--------------- ------------------ ---------------
10001-1 Jane Doe 12/22/2005

Example with Business Only
Reference No: Names: Date:
--------------- ------------------ ---------------
10001-1 XYZ Corporation 12/22/2005


Here is what is currently happening if there is a business name only

Reference No: Names: Date:
--------------- ------------------ ---------------
10001-1 12/22/2005
XYZ Corportation


In my subreport I have two fields that are RBAddOn DBText fields. In the
properties I have set the "Behavior When Blank/Zero" on each of those fields
to "Suppress". However the Business name always appears on the second line
even if the person name is blank.

Thanks for any help!

Jeff

Comments

  • edited January 2006
    Hi Jeff,

    Take a look at Demo 33 (dm0033.pas) located in the \RBuilder\Demos\1.
    Reports\... directory. This demo shows how to remove empty space between
    vertical fields if one does not have any data.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2006
    Thanks for the answer; however, this is a user created report with user
    created queries on the data tab of the designer so I don't see how this
    approach could work unless I'm missing something. Is there another way to
    get this to work using properties of the components in the report designer?

  • edited January 2006
    Jeff,

    There are two options that I can think of for your issue.

    In the designer, rather than using a DBText objects, use variables. In the
    first variable's calc event, if the person name field from your record is
    null, set the variable value to the company name. In the second variable,
    if the person name field is null, set the variable to null.

    Put each DBText object in a region and have the region with the company name
    shift relative to the person name region.

    --

    Bob

This discussion has been closed.