Need help in changing report page on certain circumstances in Jaspersoft Studio

0

Hello. I have a case that may require help here. Let's consider that I have two parameters

TYPE NAME
A Name 1
B Name 2
C Name 3
A Name 4
D Name 5
E Name 6

 

I want it that for the 1st page, it contains types A, B and C. But on the next page, it contains types A, D and E. So basically it checks the type of the row:

  • If it's not A, then just add a new row
  • If it's A, then they check how many times has it occur in the page:
    • If it hasn't occurred in the page, then they add new row. It's always going to be the 1st row.
    • If it has occurred in the page, then they create a new page.

How do I set that up for a unique page-change condition? Can't seem to find it in Jaspersoft Studio. Help appreciated. Thanks.

kristian.wijaya123's picture
Joined: Mar 24 2017 - 5:32pm
Last seen: 4 years 5 months ago

5 Answers:

0

if you are working with groups, there is a group property called 'start on a new page'. I haven't try it, but put an expression on it maybe work.

andreluis.online's picture
Joined: Mar 25 2014 - 9:59am
Last seen: 4 years 8 months ago
0

I've tried 'Start On A New Page'. However, I do not know the proper Group Expression. If I just use group expression on Type, then the result would end up like:

Type A Name 1

=====

Type B Name 2

Type C Name 3

Type A Name 4

=====

Type D Name 5

Type E Name 6

While I wanted it to be like:

Type A Name 1

Type B Name 2

Type C Name 3

=====

Type A Name 4

Type D Name 5

Type E Name 6

kristian.wijaya123's picture
Joined: Mar 24 2017 - 5:32pm
Last seen: 4 years 5 months ago
0

You could use a break element placed above the type textfield with a print when expression:

<break>
  <reportElement x="0" y="0" width="100" height="1">
    <printWhenExpression><![CDATA[$V{REPORT_COUNT} > 1 && $F{type}.equals("A")]]></printWhenExpression>
  </reportElement>
</break>

shertage's picture
2176
Joined: Sep 26 2006 - 8:06pm
Last seen: 1 year 1 week ago
0

@shertage This works to an extent. Though I forgot to say an addition. I want the REPORT_COUNT reset when we change page. How do I do that?

kristian.wijaya123's picture
Joined: Mar 24 2017 - 5:32pm
Last seen: 4 years 5 months ago
1

Just use $V{PAGE_COUNT} instead.

shertage's picture
2176
Joined: Sep 26 2006 - 8:06pm
Last seen: 1 year 1 week ago
Feedback
randomness