Reports Designer

Jaspersoft Studio is a tool that allow us to develop reports.

With this reports we can provide statistical and detailed data to our customers, helping them in their business to take decisions  based on real data.

Basic Concepts:


  • is a search to the database to find the information that we need.


  • In this section we can see the UI of the report to be created.

Layout of Jaspersoft Studio


Show us the XML file of the source code generated by the report designer.



We cab generate the report to test it from this window.


Always select the database we are using if not will default to  ‘One Empty Record’.

If exists, put the values for the report parameters. The parameters can be mark to not be seen on preview, unclicking the property ‘Is For Prompting’  of that parameter.

To download a copy in a format you can click the icon Export and select the file format. 


Repository explorer

In this section we can see all 'Data Adapters' created and you are able to query.

The data adapters are repositories that we create inside Jaspersoft and where we extract the information to generate reports.

Repository Creation

  • Open JasperSoft Studio.

  • Expando data adapter on the top left.

  • Right click on data adapter by default.

  • Click  ‘Create Data Adapter’.

The following window will pop-up and choose 'Database JDBC Connection'  then Next.

  • Add a name for our repository, in our example Integra Server.

  • Click on JDBC driver and select: com.mysql.jdbc.driver.

  • Edit JDBC Url, IP and port of our database. Format:

  • jdbc:mysql://IP:PUERTO/DatabaseName*

  • Save the  ‘username’  and ‘password’. Ask integra for the database passowords.

(See screenshots example).

Once driver is added, we click 'Test' to check if the connection is OK.

A message must appear saying that the connection was Ok.



Property of a selected element on the Report.


This section has all the elements we can include inside a report.


Bottom left we have this window, we can see the report structure in a tree format.

Element of the Outline

  • Filters for the query on the report.

    • Example: If we have a parameter AGENT, then our report sill filter the result for that agent if included on the query.
      Notation : $P{name}.


  • Creation : Right click on parameters > Create parameter.

    In case of exist parameters in our report, we can use them in the query like this:  $P!{nombreParametro}.

    This can also contains a list for example: WHERE campania IN ($P!{QUEUE}).

    To concat values we use:  ‘value1 , value2’.

    If the variable has one value, goes like this: WHERE fecha >= '$P!{INITIAL_DATE}’.




  • This are variables that take the value of a column returned by the query.
    Notation: $F{nombreColumna}.
    The fields don't need to have the same name of the column returned by the query but is a nice to have.


  • Creation: Right click on fields > Create Field.


  • Type of Field: To specify the data type of our field click on the created field and in the properties windows we have class where we put the data type of the field.

  • The variables are for store a determinate value. Used to save mathematical expressions. 


Expression: $F{comision} * ($F{over_total}==true$F{import_agent}:$F{from}) + $V{comisioncamp}

  • Creation: Right click Variables > Create Variable.


  • Expresión
    To change the expression of a variable select variable  > Change field Expression on Properties view.  

  • Type
    To change the type of a variable select variable  > Change  ‘Value Class Name’.

Edit Expressions

  • Usually we have one query that will return all data we need to show.

  • We can access a column using the fields.

  • To crete a query right click on our report in Outline then click on ‘Data Set and Query’.

As explained above, the query returns the data that we want to show.

The question is:

  • ¿Where and how  these data show?


By default the report creates an element Detail.

Detail is where the rows returned from the query are inserted.

For each row of the query we will have a detail withe the data of the fields.


Allow us to group collection of rows of the details in real groups.

Example: If you want to group by Client, Agent, Campaign in that order.

Is important to show the different between the Groups and the Group By of SQL.

Groups: Group rows of a column in a secuencial way. 


If we create a group for Columna 1 the result is

1 2 3 4 5 6 Group: foo     foo_12  foo_13     foo_22  foo_23 Group: Example     Example_32 Example_33 Group: foo

No all elements foo are under the same row, this is the main difference with GroupBy.

The way to solve this is to create a query that orders first by the column we want to group, in our case columna 1.

Example Query:

1 2 3 SELECT * FROM myFooTable ORDER BY columna1

In this case the result is:

To create a new group:

  • Right click on the report outline.

  • Create Group.

  • Add a name and select the element we want to be part of the group.

Click on finish

If we want the group header to repeat on every page we have to set on the group header property  Reprint Header On Each Page = true.

For the header to be on the same page and no pass to the next we have to assign the max height, we do this from the properties of the header group under the attribute Min Height to start new page.

In this way we avoid it is the header without the associated detail.


Free text field.

Used to assign variables, parameters and fields.

To show a textfield element we can do it in 2 ways, draggin the same textfield or modifying the regular expression of the textfield.

Appearence: Modify the look and feel of the textfield. location, size and color.

Borders Edit the borders of a textfield.

Textfield: Allow us to modify the expression of the textfield.


To add a file of internationalization of Integra, we must follow some steps:

Select the report on the outline.

On the properties we select Report.

Inside the dataset property ‘Resource Bundle’ click on examine.

Select the internationalization file integra.resources.language

You have to add the variables to the properties files in all the languages:, y

The notation is: KEY=VALUE in the language.

If has especial characters (accent, ñ, others) use unicode example  ó = \u00f3. Distribution would be Distribuci\u00f3n.

Then on the report we put the titles and headers with TextField that point to this values: Example: INITIAL_DATE a Text Field with the Expression $R{FROM}.

To test this you have to have a copy of the properties files on the directory where you have the report. Then you change Respurce bundle for: language. Then you can see the values in the correct language.

To change the language : Menu Window -> Preferences -> Jaspersoft Studio -> Report Execution -> Locale.

If you want to test a particular language you have to import the resource for that language, this is done on the proyect properties on the attribute Resource Bundle.

Example to test  español put resource bundle ‘language_es’.


The subreport is to decouple login inside the same report.

To add a subreport we have to drag the control subreport from the palette on the right top.

In our case we want the report that already exists so we click in the option select report file, otherwise we create a new one.

We add an existing one.

From the main report we can pass parameters to the subreport to filter the subreport query.

Take the values return of the query of the father report like parameters to filter the consult of subreport.


The main reports returns AGENT and CAMPAIGN, then the parameters or filters we can pass to the subreport are the values returned by  (AGENT and CAMPAIGN).

We make a relation between the subreport parameter that we want to return as a global variable (from our main report)

The subreports can return values to the main report. The way to do this is assigning a variable of the main report the value of the subreport result.

In the window of properties of subreport, under the tag off subreport we click in Return values.

We make a relation between the variable of the subreport that we want to return with a global variable (of our main report).

Make sure both variables (subreport and main report variable) be the same type.


  • Collection of data.

  • Has different columns (fields).

  • When a new record is created on the dataset, this fields are added.

  • Each dataset is independent, has its own datasource.

Right click on the report outline and select Create DataSet.

Assing a name and create a dataset from a connection datasource, and click Next.

Select database, and add a query, then Next.

Select the fields we want to get.

In case to use group by click Next if not finish.

If not group and want to finish, click Finish.

If we want to add parameters to the dataset on the control dataset of the outline right click on Parameters and Create parameter.

Tables are a way to show data from a dataset.

Use it from the Palette.

Select the dataset for the source of the table content.

Select same connection and click Next.

Select fields of the dataset to show on the table.

Edit table layout, and click in Finish.

After table created, go to properties under dataset and Parameter button.

Add a line to add the expression of the parameter from the main report to associate.