Add continue test when data overflows to next page

Hello,

I have a scenario where I have 3 Accounts: A1, A2, and A3. A1 has 4 lines of data and A2 has 4 lines of data and A3 has 20 lines of data.

On the first page, A1 is printed with 4 lines of data and A2 is with 4 lines of data, and A3 with 10 lines of data, and the remaining 10 are printed on the second page. In this case, I have to print a text that says [Continued] when printing A3 is printed on the 2nd page. I have to print this text until the next account number is printed. Ex: A3 has 100 lines and data is printed on 10 pages then I have to print the [Continued] text in 9 pages.

This has to happen in detail band.

My data source is JSON. I have an array with all account numbers and a nested array of the line data.

Can anyone help me achieve this? Tis his an urgent request from the client.

Sample output:

In detail band: 

page1

A1

l1

l2

l3

l4

A2

l1

l2

l3

l4

A3

l1

l2

l3

l4

Page 2

A3[continued]

L5

l6

l7

etc

Thank you

venky.sai1993's picture
Joined: Jun 11 2020 - 11:02am
Last seen: 3 months 5 days ago

Hey, thanks for the help. Can you show me how you created the '$V{Group1_COUNT}'? I'm new to jasper and not good with groups.

I want to print this in detail band.

venky.sai1993 - 4 months 10 hours ago

11 Answers:

It may be achieved by using '$V{Group1_COUNT} '.

'$V{Group1_COUNT} > 0' for the display condition of the "[continued]" item.


* Design Image

 

* Preview Image


 

 

 

yama818's picture
4769
Joined: Aug 17 2018 - 3:48pm
Last seen: 1 day 1 hour ago

Hey, thanks for the help. Can you show me how you created the '$V{Group1_COUNT}'? I'm new to jasper and not good with groups.

I want to print this in detail band.

venky.sai1993's picture
Joined: Jun 11 2020 - 11:02am
Last seen: 3 months 5 days ago

'$V{Group1_COUNT} ' is automatically created when the group is created, so just use it.


yama818's picture
4769
Joined: Aug 17 2018 - 3:48pm
Last seen: 1 day 1 hour ago

I created a group for account_number and a variable automatically got created. But I don't see it in the variable list when I'm trying to write an expression.

Attached screenshots

venky.sai1993's picture
Joined: Jun 11 2020 - 11:02am
Last seen: 3 months 5 days ago

I looked at your screen shot.
It looked like you were creating groups with 'sub-datasets(data)' instead of 'main dataset'.
My sample report is a simple example where only the 'main dataset' exists, so this seemed to be the difference between you and me.
I tried a little to get closer to your report, but I could not figure out how to use sub-datasets in the detail bands.
If you attach your jrmx file I might be able to look into it a bit more.

yama818's picture
4769
Joined: Aug 17 2018 - 3:48pm
Last seen: 1 day 1 hour ago

Is there a way I can send the file directly to you, instead of posting here?

venky.sai1993's picture
Joined: Jun 11 2020 - 11:02am
Last seen: 3 months 5 days ago

I don't think it is a good idea for you and I to communicate one-on-one, as it may not be helpful to other viewers of this community site.
Can you create a new, simple, publishable sample report that you can reproduce the event?
If that is very difficult, I will reply to the email you have sent to me and you can attach it to that email and reply again.

 

yama818's picture
4769
Joined: Aug 17 2018 - 3:48pm
Last seen: 1 day 1 hour ago

Attached the.Jrxml and Json files

venky.sai1993's picture
Joined: Jun 11 2020 - 11:02am
Last seen: 3 months 5 days ago

I have checked your jrxml and json files.

In conclusion, I unfortunately did not succeed in fulfilling your request.
I apologize for not being able to help you.

I will only share a hint to the solution.

The way you are making it now, the '$V{Group1_COUNT}' value does not return the expected value.

* Image of how it is made now
main-dataset
 └ sub-dataset(data) --> list1(3 items retrieved)
  └ sub-dataset(transaction) --> list2(67 cases retrieved [breakdown: Grp1=60 cases + Grp2=5 cases + Grp3=2 cases])

To get the value of '$V{Group1_COUNT}' as expected, it is necessary to get sub-dataset(data) and sub-dataset(transaction) together.

* Image of how to create after the change
main-dataset
 └ sub-dataset(data-transaction) --> list1+2 (67 items obtained [breakdown: Grp1=60 + Grp2=5 + Grp3=2])


sub-dataset(data-transaction) is based on sub-dataset(transaction) with the addition of 'account_desc' and 'account_total'.
One thing to note is that the language needs to be changed from 'JSON' to 'jsonql'.
The reason for this is that I need to write '^{2}.xxxxxx' in the expression to get the data one level up.
I have been successful up to the data preview on the dataset definition.


However, I could not use this sub-dataset(data-transaction) to display data in ListConpornent.
Since existing sub-dataset(data) and sub-dataset(transaction) are available, you can most likely solve this problem.

By the way, I created a simple report to investigate this solution.
To my surprise, it succeeds without difficulty when the source data is 'MySQL(RDMBS)', but fails when the source data is a 'JSON file'.
I am not used to dealing with 'JSON files', so I believe there is a solution, I just don't know about it.

 

yama818's picture
4769
Joined: Aug 17 2018 - 3:48pm
Last seen: 1 day 1 hour ago

Thanks for helping out. Can you show me how you created the '$V{Group1_COUNT}'? I just started using Jasper and I don't do well in groups.  gmail
 

Justinmachany932's picture
Joined: Aug 16 2022 - 8:39pm
Last seen: 3 months 1 week ago

As mentioned above, '$V{Group1_COUNT} ' is automatically created when creating a group, so just use it.

The following wiki is a good reference on how to create groups.
https://community.jaspersoft.com/wiki/groups

 

yama818's picture
4769
Joined: Aug 17 2018 - 3:48pm
Last seen: 1 day 1 hour ago
Feedback
randomness