d7omz1996 Posted November 24, 2020 Share Posted November 24, 2020 HelloI'm using Jaspersoft Studio and I want to create a report by using Json as datasource,This example of my json structrue for firt two node a1 and a2:_{ "a1": { "a1_1": 5127, "a1_2": "fg af ag g", "a1_3": "gaf gaer ", "a1_4": "142", "a1_5": "2020-02-25T21:00:00.000+0000", "a1_6": "2020-11-05T21:00:00.000+0000", "a1_7": { "a1_7.1": "4", "a1_7.2": "arew", "a1_7.3": "jgfh", "a1_7.4": "rtwer", "a1_7.5": "fsfs" } }, "a2": [ { "a2_1": 5127, "a2_2": "lab lab lab.", "a2_3": "Good", "a2_4": "2020-02-25T21:00:00.000+0000", "a2_5": "2020-11-05T21:00:00.000+0000", "a2_6": "2020-02-25T21:00:00.000+0000", "a2_7": "SA", "assignmentWithRolesHttpBodies": [ { "a2_1.1": 145, "a2_2.1": "lab lab lab.", "a2_3.1": "Good", "a2_4.1": "2020-02-25T21:00:00.000+0000", "a2_5.1": "2020-11-05T21:00:00.000+0000", "a2_6.1": "2020-02-25T21:00:00.000+0000", "a2_7.1": "KSA" }, { "a2_1.2": 146, "a2_2.2": "lab lab lab.", "a2_3.2": "Good", "a2_4.2": "2020-02-25T21:00:00.000+0000", "a2_5.2": "2020-11-05T21:00:00.000+0000", "a2_6.2": "2020-02-25T21:00:00.000+0000", "a2_7.2": "India" }, { "a2_1.3": 147, "a2_2.3": "lab lab lab.", "a2_3.3": "very Good", "a2_4.3": "2020-02-25T21:00:00.000+0000", "a2_5.3": "2020-11-05T21:00:00.000+0000", "a2_6.3": "2020-02-25T21:00:00.000+0000", "a2_7.3": "UAE" }, { "a2_1.4": 148, "a2_2.4": "lab lab lab.", "a2_3.4": "Good", "a2_4.4": "2020-02-25T21:00:00.000+0000", "a2_5.4": "2020-11-05T21:00:00.000+0000", "a2_6.4": "2020-02-25T21:00:00.000+0000", "a2_7.4": "US" }, { "a2_1.5": 149, "a2_2.5": "lab lab lab.", "a2_3.5": "Good", "a2_4.5": "2020-02-25T21:00:00.000+0000", "a2_5.5": "2020-11-05T21:00:00.000+0000", "a2_6.5": "2020-02-25T21:00:00.000+0000", "a2_7.5": "India" } ] } ] }[/code] ___________________________________So, the json is contained multi node and I can't access to two node (a1, a2) in one report data set so I tried to make subreport using same data adapter to let subreport print a2 data in main report which has the a1 data. and the subreport work individually very well but not reflected in the main!!if you know the ptoblemthe why subreport cannot be reflected in the main !! this is the code in the -Main report <subreport> <reportElement x="36" y="13" width="254" height="200" uuid="6156be9a-2e27-478d-bd32-6f28f9b22389"/> <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression> <subreportExpression><![CDATA["repo/Blank_A4.jasper"]]></subreportExpression> </subreport>[/code]Thank you for reading,, Please help if you can.. Link to comment Share on other sites More sharing options...
narcism Posted November 24, 2020 Share Posted November 24, 2020 Which objects can't you access? What is the desired output of your report? Link to comment Share on other sites More sharing options...
d7omz1996 Posted November 24, 2020 Author Share Posted November 24, 2020 when I want to add field by using "Dataset and Query Dialog" I can't access a1 and a2 in the same time to add the Field Link to comment Share on other sites More sharing options...
d7omz1996 Posted November 24, 2020 Author Share Posted November 24, 2020 I want to be able to access to all the value in the json file as field I can place the fild wherever I want,I did't try Parameebters. becuse I do not know how to use it in Json way.I tried Create Dataset but when I use the Field of the new dataset the error message "You drop an object ........." Link to comment Share on other sites More sharing options...
narcism Posted November 24, 2020 Share Posted November 24, 2020 Please also post how you want your output to look like(you could edit the question). The Dataset and Query Dialog may not offer much help in your case, as you have varying JSON keys. Link to comment Share on other sites More sharing options...
d7omz1996 Posted November 25, 2020 Author Share Posted November 25, 2020 Is it clear now? Link to comment Share on other sites More sharing options...
narcism Posted November 25, 2020 Share Posted November 25, 2020 Not quite. The desired output is something close to what you expect your report template to produce when previewed. Based on this output I can decide if what you are trying to produce can be achieved or not in terms of JRXML syntax. Link to comment Share on other sites More sharing options...
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