Jump to content
We've recently updated our Privacy Statement, available here ×
  • Exploit a single jrxml report file to achieve scalability


    Domenico Donofrio
    • Version: v9.0.0, v8.2.0, v8.2, v8.1.1, v8.1.0, v8.1, v8.0.3, v8.0.2, v8.0.1, v8.0.0, v8.0, v8 Product: JasperReports® Server

    Scenario:
    You want to use a report that can run independently or be included in a report book or else in another report as sub-report.

    Suppose you want to make some changes to this report.

    Using the following technique it will be possible to modify only the .jrxml file and the changes will be propagated:
    - To the report that runs independently depending on the .jrxml file. 
    - To the Book that contains the same report, or else to any master report which embeds the report as sub-report.

    To upload a report jrxml file in JasperReport Server, access the repository view and:

    1: Right click on any directory where you want to save the file.

    2:- Click on "Add resource" then "File" and then "JRXML", select the .  jrxml file and give any name.

    image.thumb.png.10cbb0052233a1c9aaed350abcd344ce.png

    After doing that, you can create a new report i.e. in the same directorywhere you uploaded the jrxml file.

    To do that, from Repository view:

    1: Right click on the directory where you want to create the new report.

    2: Click on "Add resource" then "JasperReport"

    3: As it is shown in the following screenshot, select the JRXML file from the repository by using its assigned repository's path.

    image.thumb.png.5fc706c2dc6cd91daeb3afc0c8279763.png

    4: Set the needed Data Source for the report to run, then click on submit.

    The first part is done, you have a jrxml file and a Report Unit depending on it.

    You can now define a report Book that embeds the same jrxml as report. (Or else a master reports that embeds it as sub-report).

    In both cases, when creating the book, you can reference directly the jrxml file that is on the server and that you uploaded first.

    To do that, when creating the Book on Jasper Studio, you can include the content from the jrmxl file by setting its repository's path in the Component Expression, i.e. "/public/report".

    The same thing can be done when including the jrxml as a subreport.

    image.png.7b3bd324436dda01dd1205c327a1e6a2.png

    Save the Book and publish it on the JasperReports Server.

     

    Finally, you will have defined a Jasper Report and a Book (or a master report) that embeds the same jrxml file. Each time a modification is performed on this file, it will be visible both on the Jasper Report and in the Book itself being the same file referenced by the 2 containers.

    At scale, you can have multiple embedding containers (Jasper Reports, report Book, master reports), that embeds a jrxml and each modification performed to that single file will be propagated to them.

     

     

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.



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