![]() |
Consumption Analytics Documentation |
You can create custom reports by using the Jaspersoft Studio application. This section of articles contains the following:
This article explains how to create a new report, either by creating a report from scratch or by modifying an existing report, and how to change the style of all standard reports.
Before you begin the process of creating custom reports, you must install Jaspersoft Studio and ensure that you have a Cloud Cruiser stored procedure to obtain the data you want to use in your report. Optionally, you can configure Jaspersoft Studio to connect with your Cloud Cruiser database.
The Community version of Jaspersoft Studio is available for free. For more information, visit the Jaspersoft Community website at http://community.jaspersoft.com/project/jaspersoft-studio.
In Jaspersoft Studio you define what data you want in your report, but the actual retrieval of data from the Cloud Cruiser database at runtime is handled by a stored procedure. Within the stored procedure you define the SQL statements necessary to retrieve the data you want. You then use the call_procedure
property in your report .jrxml
file to call the stored procedure. If an existing stored procedure retrieves the data you need, new reports can reuse that stored procedure. For more information, see Managing stored procedures.
As an optional procedure, you can configure Jaspersoft Studio to connect with your Cloud Cruiser database. This enables you to include Cloud Cruiser database fields in your report and view the quality of your report with real data before you load it to Cloud Cruiser.
To configure Jaspersoft Studio to connect with Cloud Cruiser
Cloud Cruiser Adapter
.MS SQL Server (net.sourceforge.jtds.jdbc.Driver)
jdbc:jtds:sqlserver://localhost:1433/ccdb
.jar
file installed with Cloud Cruiser.<install_directory>\Cloud Cruiser\lib\jtds-1.2.6.jar
To create a report from scratch
SELECT * FROM dbo.account_field
<jasperReport>
tag includes a name
parameter with the name of your report as its value. This piece of metadata must be unique within Cloud Cruiser to distinguish this report from other reports. If there is no name
attribute, or the value is not unique within Cloud Cruiser, the import of the report will fail.<jasperReport>
tag, add the following attribute-value pair: scriptletClass="com.cloudcruiser.core.report.DataUtilScriptlet"This attribute allows the Jasper report to make use of Cloud Cruiser's
DataUtilScriptlet
library, which is required for parameters to work properly in the report.<jasperReport>
tag, add the following properties, where <group_name>
is the name of the report group that will contain this report on the Standard Reports page of the Cloud Cruiser console, and <sp_name>
is the name of the stored procedure that will retrieve data from the Cloud Cruiser database. For more information about these and other properties you can define in your report, see Report properties and parameters. <property name="com.cloudcruiser.report.group" value="<group_name>"/> <property name="com.cloudcruiser.report.view_type" value="HTML"/> <property name="com.cloudcruiser.report.cache_type" value="REPORT"/> <property name="com.cloudcruiser.report.restricted" value="true"/> <property name="com.cloudcruiser.report.call_procedure" value="<sp_name>:inAccountLevel,inAccountFieldValues"/>For example, the following image shows a report that will be added to the Invoices group in Cloud Cruiser, and which calls a stored procedure named
sp_sample
:<queryString>
line. Parameters appear as fields on the Parameters page in Cloud Cruiser.<parameter name="inAccountLevel" class="java.lang.String"> <property name="com.cloudcruiser.param.account_level" value="All=0"/> </parameter> <parameter name="inAccountFieldValues" class="java.lang.String"> <property name="com.cloudcruiser.param.account" value=""/> </parameter>
.jrxml
file.SELECT * FROM dbo.account_field
, you must remove the following lines: <queryString> <![CDATA[SELECT * FROM dbo.account_field]]> </queryString>
.jrxml
file..properties
file with the same name as your report .jrxml
file.SampleReport.properties
.<title>
is the name of your report and <description>
is the description that appears under the title in Cloud Cruiser. com.cloudcruiser.report.default_title=<title> com.cloudcruiser.report.description=<description>
.jrxml
file, add a label and description for each parameter to the .properties
file. This allows Cloud Cruiser to display the parameter and provide appropriate field values on the Parameters page of the report.inAccountLevel
and inAccountFieldValues
to your .jrxml
file, add the following lines to the .properties
file: com.cloudcruiser.param.inAccountLevel.label=Account Level com.cloudcruiser.param.inAccountLevel.description=Select the account level you want to use for this report
.jrxml
file includes $R{}
resources, update your report .properties
file to include a line that defines the string to be displayed when the report is run..jrxml
file includes an $R{report.footer.total}
resource to add the text string "Total" as a footer element under a column of data, you would include the following line in your report .properties
file: report.footer.total=Total
.properties
file.If an existing report is similar to the report you want, you can copy the report .jrxml
and .properties
files, and then edit them to suit the needs of your new report.
While copying a report can be faster than creating a report from scratch, it also has the potential to be more complicated, especially if you are copying one of the Cloud Cruiser standard reports. Some reports make extensive use of Jasper variables, parameters, and resources. Some parts of the report might have dependencies on other content, and these dependencies can be difficult to identify. Because changing or deleting lines from the .jrxml
file can cause problems in the report, consider copying a report only if you need to make few and simple changes.
To create a new report from an existing report
<install_directory>/reportfiles
directory, locate the .jrxml
and .properties
files of the report you want to copy.C:\cc-working\custom_reports
.reportfiles
directory. reportfiles
directory, skip to the next step. Otherwise, to give your new report a unique name, rename the report .jrxml
and.properties
files to match.InvoiceWithTiers
(the Standard Invoice in the Cloud Cruiser Portal) to CustomInvoice
you must change the names if the InvoiceWithTiers.jrxml
and InvoiceWithTiers.properties
files to CustomInvoice.jrxml
and CustomInvoice.properties
.Report Name
and Resource Bundle
properties in the report template to match the new file name.CustomInvoice
, the Report Name
and Resource Bundle
properties must have a value of CustomInvoice
..jrxml
file in Jaspersoft Studio and make the desired changes..properties
file in a text editor and make the desired changes.The standard reports shipped with Cloud Cruiser reference a style template for common header colors and fonts. You can change these attributes.
To modify styles for all standard reports
<installDir>\apache-tomcat-7.0.54\webapps\ROOT\skins\CC\StdReportStyleTemplate.jrtx
.(c) Copyright 2017-2020 Hewlett Packard Enterprise Development LP