Jump to content

When is a printwhen expression evaluated?


tdiffenbach

Recommended Posts

I have a result set that may have 1 or more than one row for a group.

 

Example: grouping on parent_id:

 

parent_id | child_id | data

1 | 1 | foo

2 | 2 | bar

2 | 3 | baz

 

When the number of rows in the parent_id group is one, I want to suppress printing of the detail band.

 

So I create the following variable:

 

<variable

name="childen_per_parent"

class="java.lang.Integer"

resetType="Group"

incrementType="Group"

incrementGroup="parent_id"

resetGroup="parent_id"

calculation="DistinctCount">

 

<variableExpression>

<![CDATA[$F{child_id}]]>

</variableExpression>

</variable>

 

In the parent group band, I get the correct count of children.

 

For the detail band, I use the following print-when expression:

 

<printWhenExpression>

<![CDATA[boolean.valueOf($V{ichilden_per_parent}.intValue() > 1)]]>

</printWhenExpression>

 

Unfortunately, this results in the first row of child data being suppressed, even if the total children for that parent is greater than one.

 

What am I missing here?

 

Thanks.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...