Top 20 JasperReports/JasperSoft Interview Questions Answers PDF

1). Explain what is Jasper Reports?
Ans: Jasper Reports is used to Generate the reports from the Database. A powerful report-generating tool that has the ability to deliver rich content onto the screen, to the printer or into PDF, HTML, XLS, CSV and XML files.

2). What do you understand by JRXML?
Ans: JasperReports reports are defined in an XML file format, called JRXML, which can be hand-coded, generated, or designed using a tool. The file format is defined by a Document Type Definition (DTD) or XML schema for newer versions, providing limited interoperability.

3). How to set dynamic main report width when using crosstab?
Ans: For a single crosstab use the attribute ignoreWidth="true"

4). How to create crosstab derived measure?
Ans: Cross tab fills the data at the time of report execution. So it is not possible to find more calculations on already calculated on filled values rather you need to define the Type01/Type02 with in your SQL query so that you can another measure.

5). Main features of JasperReports?
Ans: Some of the main JasperReport features include:
Has flexible report layout.
Multiple ways to present data, it can present data textually or graphically.
JasperReports can generate watermarks.
Developers can supply data in multiple ways.
JasperReports can generate subreports.
JasperReports can accept data from multiple datasources.
JasperReports is capable of exporting reports to a variety of formats.

6). What do you understand by Multiple ways to supply data feature, Can you explain?
Ans: JasperReports allows developers to pass data to a report through the report parameters, Report parameters can be instances of any Java class. Data can also be passed to a report by using special classes called datasources. Report parameters and datasrouces can be combined to maximum flexibility.

7). Name any three main Jasper Managers classes?
  • net.sf.jasperreports.engine.JasperCompileManager: Used to compile a JRXML report template.
  • net.sf.jasperreports.engine.JasperFillManager: Used to fill a report with data from a datasource
  • net.sf.jasperreports.engine.JasperPrintManager: Used to print the documents generated by the JasperReports library
8). How to save the compiled JasperReport as a .jasper in a file?
Ans: You can use following method: JasperCompileManager.compileReportToFile("C:\\xxx.jrxml", "C:\\xxx.jasper");

9). What is the difference between ireport and jasperreport?
Ans: iReport is a graphical report designer tool that uses JasperReports API. Designing the reports become easy if we use iReport.
JasperReports API is the build that was/is being released by Jasper Team(JasperSoft) that provide necessary jar files that are helpfull in creating reports.

10). What is Jaspersoft OLAP?
Ans: In general, Jaspersoft OLAP refers to the Business Analysis capability found in JasperReports Server. Business Analysis is also known as OnLine Analytical Processing (OLAP), and is enabled via the Open Source projects Mondrian and JPivot.

11). What is JasperReports Server?
Ans: Typically, JasperReports Server refers to both the core server functionality (creating and managing users and roles, assigning permissions, scheduling reports, etc) and to the Business Reporting functionality which is enabled by JasperReports.

12). How to pass a parameter list for the same field in the prompt iReport?
Ans: Create a parameter and precede the parameter of the SQL query of the report by one! . To run the report, enter prompt in the desired parameters separated by commas to respect SQL syntax. Example:
sql code:
SELECT * FROM    myTable  WHERE   mycode IN  ( $ P! { MonParametre } )

13). How do you limit the number of rows on each page in JasperReport?
Ans: If you want to display max number of rows in each page to 5, then you can use
$V{REPORT_COUNT} % 5 == 0

14). How to change date format (month name) in iReport?
Ans: To display dates in different formats, one option is to format dates based on locales. For example, the following expression uses the current user's locale:
DateFormat.getDateInstance(DateFormat.LONG, $P{REPORT_LOCALE}).format($F{currentDate})

15). Write a sample code to show an image on jasper report?
Ans: <imageExpression class="java.lang.String">
      <![CDATA[$P{REPORTS_DIR} + "/images/logo.jpg"]]>

16). How to display date in HH:mm:ss format in JasperReports?
Ans: You can use following code in Java:
new SimpleDateFormat("MM-dd-yyyy HH:mm:ss z").format($V{VAR_DATE})
where $V{VAR_DATE} is the date variable to be converted into the format.

17). What is the difference between .jasper, .jrprint, .jrpxml, .jrxml JasperReport file formats?
  • .jrxml is a human readable XML file that contains the report template i.e. report structure and its formatting rules.
  • .jasper is the compiled report template i.e. compiled .jrxml file. You use this file as the template argument in the JasperReports API.
  • .jrprint is a serialized JasperPrint object i.e. an actual report instance i.e. a template that has been filled with data. This file can be deserialized back into a JasperPrint object.
  • .jrpxml is a human readable XML represenatation of a JasperPrint object i.e. an XML version of a template that has been filled with data. This file can be unmarshalled back into a JasperPrint object.
18). What is the difference between variable, parameter and field in Jaspersoft iReport Designer?
  • Parameters are simple input to JasperReports. You have to define parameters in the JasperReport before using them. You can display the value of the variable, you can use it as part of boolean expressions and you can even pass it to subreports. This can be an input to SQL query.
  • Fields are simple variable definitions. You can think of these as instance variables of the datasource object thats passed in to the report or they can be key names if the datasource is a Map. If you configure JasperReport to create the dataset based on SQL, then Fields are the column names of the ResultSet. You will use Fields to display the resultset of an executed SQL query.
  • Variables are another kind of variables that live within Jasper Report, they are not inputs. They are used to calculate sum or average of certain Field (defined above). You can perform many other predefined calculation functions on the Fields using Variables.
19). How you will avoid null values in jasper reports?
Ans: By set the property isBlankWhenNull to true.
In iReport check the Blank When Null checkbox when your field is selected.
In jasper jrxml file: <textField isBlankWhenNull="true">

20). What are the drawbacks with Jasper Reports?



Contact Form