Jaspersoft BI Tools

iReport,Jaspersoft Design Studio,Jaspersoft Server, Schema Workbench,Analysis,Dashboards, Self Service BI, Domains,Topics,Ad-Hoc Reports, Jaspersoft ETL, Embedding BI,HTML-5 charts, Fusion Charts,JFree Charts,Drill down reports , Drill down Dashboards,Visualize.js, Performance Tuning, D3 Charts, Jaspersoft Customization

Thursday, April 14, 2016

Learn how to create Jaspersoft Studio based Topics (JRXML based Topics ) then Ad Hoc Views and Reports using it in Jaspersoft 6.2 or later


This post will talk about how to create topics from Japsersoft Design Studio.

Software used for this example : 
1) Jaspersoft Design Studio 6.2 Professional
2) Japsersoft 6.2 Professional Server
3) Foodmart database - PostgreSQL database server

Few Questions : 
1) What are topics ? What is the usage ?
2) What are the types of topics ? When to go for which type ?
3) What is the difference between regular report or studio based topic ?

Jaspersoft offical documentation references : 
1) Creating Topics :
2) Topics - Domains :
3) Jaspersoft Domains & topics references

 Basic understanding of  Studio based topics : 

Example : Step by Step Procedure : 
1) File -> New -> JapserReport -> FoodmartTopic.jrxml
2)  SQL 

 3) Points to note down 
#) This is a parameterised JRXML which will be populated while creating the Ad-Hoc view
#) i.e., pre-filter the data at SQL level and the same will be asked while creating ad hoc view.
#) Parameter Name : param_Gender and type is : java.lang.String
#) Need not to design anything here in JRXML but you can use $R{} report object to localize.

4) Changing Label names in JRXML level for Studio based topics
#) In above image, you can observe the field names are like "state" , "occupation"  and etc.
#) You can change "state" as "Store State" as label name. 
#) For doing this you need to add "adhoc.display" property in the JRXML
#) Example : change state to "Store State"

    <field name="state" class="java.lang.String">
     <property name="adhoc.display" value="Store State"/>

#) remove / for > in first line , and write end tag for it </field> , in between write the property. 

5) Save the JRXML and now its time to send/publish it the server. 

6)  Uploading JRXML as JasperReport (This will become Topic when creating ad-hoc view)
Name of the Report/Topic : FoodMartTopic 

I am taking "Topics" folder available in under /public/adhoc/topics for keeping/publishing the JRXML created.
 If it is organize specific you may see Topics folder under /organizations/organization_1/adhoc/topics

What I observed, when I keep it in some other folder it is not populating as ad-hoc view when we create. 

Step-1 : As shown in below figure, navigate to JasperReport from Public -> Topics -> Add Resource -> Jasper Report

Step-2 : Browse for the JRXML as shown below image

Step-3 : Edit the Data source
 Step-4: Add the input control (param_Gender)
NOTE: We are taking a filtered JRXML for topic and it should be available while creating the view.

 Thats all, we are done with uploading JRXML that will become as "Topic".

Now, its time to create "Ad Hoc View" then "Ad Hoc report" on top of it.

7) Creating Ad Hoc View and Ad Hoc Report
Step-1: From Jasperserver menu bar click on "Create" -> "Ad Hoc View"
Step-2 : Select the "FoodmartTopic" as shown in below image. 
Step-3: When we click on "OK" it will open Ad Hoc editor with "Input Controls" window popup. 
#) By default it will display "NULL" in input control as we set the type as "Static Text" while creating input control for the topic. You can change it to "Single Select" query or to other types.
#) Type "F" value in filter as shown in below image then click on "OK" button.

(Click on Image to get the best view of content in it)

Step-4 : Select the type of Ad hoc view ( Lets take cross tab type) and drag and drop the "Dimensions" and "Measures" of your choice. 
A sample is shown in below image. 

(Click on Image to get the best view of content in it)

Step-5: Save this ad Hoc view as View as well as Report. 

Step-6 : Running the Report created 

Observe the view & Report ( I took same folder to keep both)
Now, running the report (Select the report and click on "Run" button).

This way one can work with Studio based topics for Ad Hoc views and Ad Hoc Reports. 

Download Examples and Setup : 
2) Server Project Zip file (There are other examples in zip - Go with the images that you see in this post)
3) Deployment procedure : Import the zip file in Professional or Enterprise Server and point out to foodmart database to Topic, View and Report.

Click Me to Download

#) View is like Report. Don't get confuse with the Type because uploading a normal JRXML as a report will have same type . i.e., "Report" 

I hope this will help someone in the community. If you find it useful, please hit on google share button and help the other. 

Thank you for visiting this page. 

Until Next..
Sadakar Pochampalli 


  1. Hi Sadhakar,

    Can we use stored procedure instead of a query for this kind of reports/adhoc views.



  2. Hi Raghavendar,
    I have not tried with stored procedure but I think it should work. Lets give a try and check.
    Make sure you need configure SP working on server side.

  3. Hi Sadakar,

    I have tried using stored procedure and it did not work. Did you give a try. My database is oracle.


  4. No Raghav, I haven't explored for your use case.