venky.sai1993 Posted July 28, 2022 Posted July 28, 2022 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: page1A1l1l2l3l4A2l1l2l3l4A3l1l2l3l4Page 2A3[continued]L5l6l7etcThank you
yama818 Posted July 28, 2022 Posted July 28, 2022 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
venky.sai1993 Posted July 29, 2022 Author Posted July 29, 2022 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 Posted July 29, 2022 Author Posted July 29, 2022 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.
yama818 Posted July 30, 2022 Posted July 30, 2022 '$V{Group1_COUNT} ' is automatically created when the group is created, so just use it.
venky.sai1993 Posted July 30, 2022 Author Posted July 30, 2022 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
yama818 Posted July 31, 2022 Posted July 31, 2022 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.
venky.sai1993 Posted July 31, 2022 Author Posted July 31, 2022 Is there a way I can send the file directly to you, instead of posting here?
yama818 Posted July 31, 2022 Posted July 31, 2022 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 Posted August 6, 2022 Posted August 6, 2022 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 nowmain-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 changemain-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 Posted August 17, 2022 Posted August 17, 2022 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now