Jump to content
We've recently updated our Privacy Statement, available here ×
  • How to create a domain from a JSON file


    Friendly User
    • Features: Data Sources, Domains Product: JasperReports® Server

    Scenario:

    You have a JSON file that can be used as a data source from report. In TIBCO JasperReports® Server you want to create a new domain based on that JSON file and allow users to build ad hoc reports. How to achieve this?


    Solution:

    JasperReports® Server provides a few types of JSON based data sources and most of them include domains. The best one to use currently (7.5.0) is to use a JSONQL data source. To use that data source and build a domain over it you'll need to do the following:

    1. Enable the data source in the server. To enable it, edit the {JRS WAR}/WEB-INF/applicationContext-remote-services.xml. In the file locate the following list:

          <util:set id="customDataSourcesToHide">

      Inside the set, comment out jsonQLDataSource: <!--value>jsonQLDataSource</value-->
    2. Save the file and restart JasperReports Server
    3. In JasperServer, create a new data source. In the data source type, select JSONQL Data Source.
    4. Configure the data source. Specify the location of your JSON file in the repository or provide a web URL where the file can be obtained from.
    5. Configure the number pattern and date pattern. Both can be left as empty but your dates and numbers in that case will be recognized as strings. The patterns are standard Java patterns:
    6. In the Query section just put an asterisk *. This means that we are going to select everything from the file.
    7. Use connection set to default false. This flag indicates whether we want to use the query from the data source exclusively or use the report query which can be different. In case of domains it doesn't matter but if you want to base other reports on this data source and have their query influence the result set, this needs to be set to false
    8. Save the data source
    9. Create a domain. In the domain data source, specify the JSONQL data source as the domain source
    10. Select the tables, create the domain, proceed to use with ad hoc editor

    NB: JSONQL itself is a powerful data source with it's own JSON query language. You can read more about it here:

    http://jasperreports.sourceforge.net/sample.reference/jsonqldatasource/index.html


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