Jump to content
We've recently updated our Privacy Statement, available here ×
  • Sample of JSON report with sub report


    akonkin
    • Features: Data Sources, Reports Version: v6.1 Product: JasperReports® Library

    In this article I would like to share with you a practical sample of the

    report and subreport that uses JSON data source.

     

    This sample was tested and worked with JasperSoft Studio 6.1.

     

     

    The test report contains:

     

    - main report

    - sub report

    - data adapter that describes json file

    - json file that is used to provide data for both reports

     

    To run this report (in JasperSoft Studio 6.1):

     

    • open the Data Adapter file (in our case People.xml) and update

        the path to the file that contains JSON data in your environment

        (people.json). Please refer to the screenshot below:

     

     

    2015-09-03_1136_1.png.5e80a9e2fd6fa27d649cc5dd013aa56b.png

     

    • import updated People.xml data adapter to JasperSoft Studio.

        To do this I would suggest that you should place this file

        to your Studio’s workspace and then import it to Studio.

        Please see the screenshot below:

    2015-09-03_1142_2.png.638c8824758805ec782d3375eee1a933.png

     

    • please check that the Data Adapter that was just imported

        uses a valid path to the physical file with JSON data and can

        find it:

    2015-09-03_1143_3.png.26f8a09eb059c337d35e0d6e0ef50a01.png

     

     

    • define a data adapter for this report.

        To do this please select the data adapter that has been created

        on the previous step:

    2015-09-03_1148_4.png.f79b6f425fe205beb8c6b1a150a7cea4.png

     

    After this you can run the report.

    2015-09-03_1152_5.png.3d745cc32752d721838b0c27e7b95339.png

     

    I hope that this article would allow you to do your first steps with

    JasperSoft Studio and report/sub report based JSON solution.

     

    P.S.: many thanks to Tom Chen who shared with me this sample.

     

     

     

     

    demo4james.zip


    User Feedback

    Recommended Comments

    Hello dear,

    I want to learn a little bit more about this schema for add a subreport in the project with JSON. A tried add a new jrxml in my project and link it on the main file, but I can't do it, I don't know why. I can run the subreport but when I put it in the main project doesn't work.

    Thx for the help.

    Link to comment
    Share on other sites



    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...