- 09 Aug 2024
- 5 Minutes to read
- Print
- DarkLight
Generating reports
- Updated on 09 Aug 2024
- 5 Minutes to read
- Print
- DarkLight
The Zilliant CPQ reporting engine enables you to retrieve and print detailed quote information. Reports are available in two formats:
- Portable Document Format (PDF)—CPQ uses the JasperReports library to format and print reports in PDF format.
- Microsoft Excel Open XML Format (XLSX)—CPQ generates XLSX files by using the JXLS library .
Generate reports
Parameters to get information for reports
The reporting engine prepares and generates complete data about a quote, including its sales items and their configuration, and any other related information.
To get data attributes for the report, use the following JSONs.
JSON for a quote header is:
http://HOST/iss/webapp/quote/salesItemInstanceTreeForReportHeader?quoteId=<paramQuoteId>
,
where paramQuoteId is the encoded URL.
data = {
"value": {
"- instance": {
"id": "http://www.inmindcomputing.com/application/application-implementation.owl#d8032c5b7c1c44a0bd58796318b071f5"
},
"- type": {
"id": "http://www.inmindcomputing.com/application/application-schema.owl#Quote"
},
"- attributes": [
{
"type": "data",
"- attribute": {
"id": "http://www.inmindcomputing.com/application/application-schema.owl#quoteId"
},
"l10nKey": "Quote ID",
"multiValued": False,
"readOnly": False,
"hidden": False,
"mandatory": False,
"enumerable": False,
"position": 0,
"- value": [
"0001/AHIL/FY15/0001"
],
"valuetype": "string"
}
]
}
}
- To view JSON files in Google Chrome, install the JSONView extension.
- To open a
.jrxml
file, download JasperSoft Studio .
The .jrxml
file has the following parameters that are used for PDF and Excel reports:
Method Name | Data Type | Usage |
---|---|---|
Quote (Parameter) | com.imc.datamodel.transferobjects.BusinessObjectDTO | Gets the quote header information. |
SalesItem (Field) | com.imc.datamodel.transferobjects.BusinessObjectDTO | Gets information about a line item. |
CMIS (Parameter) | java.lang.String | Displays images. |
REPORT_LOCALE (Parameter) | java.util.Locale | Current locale for which the report is generated. |
REPORT_RESOURCE_BUNDLE (Parameter) | java.util.ResourceBundle | Resource bundle that is bonded with the report. |
currentDate (Parameter) | java.lang.String | Today's date, in DD_MM_YYYY format. |
VAR_LOGGED_IN_USER (Parameter) | java.lang.String | Currently logged in username. |
VAR_LOGGED_IN_USER_ROLE (Parameter) | java.lang.String | Currently logged in user role. |
SUBREPORT_XXXXXX, where XXXXXX is the sub-report name (Parameter) | net.sf.jasperreports.engine.JasperReport | Optional. Available only if the report is using a sub-report. |
To access these parameters also in subreports, pass the REPORT_PARAMETERS_MAP from the main report to the subreport.
<subreport>
<reportElement x="6" y="11" width="545" height="200" uuid="190d17f1-ced8-4d82-a340-32c58ed18fff"/>
<parametersMapExpression><![CDATA[$P{REPORT_PARAMETERS_MAP}]]></parametersMapExpression>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{SalesItem}.getAttributeValues("includesPriceItem"))]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_quotePriceItems}]]></subreportExpression>
<subreport>
Use the Groovy Additional Data for Proposal Generation endpoint to enhance the report by passing additional data.
Utility methods to get information for reports
Use the following utility methods to retrieve quote and sales item information.
Method | Details | Excel | Deprecated | |
---|---|---|---|---|
getAttribute(String fragment) | Accept a single fragment as a parameter. Useful for getting attribute information such as l10nKey. | YES | YES | NO |
getAttributeLongValue(final String fragment) | Accept a single fragment as parameter. Useful for getting a long description of an attribute. | YES | YES | YES |
getAttributeValue(final BusinessAttribute...businessAttributes) | Accept one or more business attributes as parameters and return a single value. If more than one level, use BusinessRelationAttribute followed by BusinessDataAttribute. | YES | NO | NO |
getAttributeValue(final String...fragments) | Accept one or more fragments as parameter and return a single value. If more than one level, use BusinessRelationAttribute followed by BusinessDataAttribute. | YES | YES | NO |
getAttributeValues(final BusinessAttribute...businessAttrbutes) | Accept one or more business attributes as parameter and return a list. If more than one level, use BusinessRelationAttribute followed by BusinessDataAttribute. | YES | NO | NO |
getAttributeValues(final String...fragments) | Accept one or more fragments as parameter and return a list. If more than one depth, use BusinessRelationAttribute followed by BusinessDataAttribute. | YES | YES | NO |
getDALabel(String dynamicAttributeName) | Accept dynamic attribute name as parameter and return label(l10nkey) of dynamic attribute. | YES | YES | NO |
getDAValues(String dynamicAttributeName) | Accept dynamic attribute name as parameter and return dynamic attribute’s configuration values as list. For DDA, its current value is returned. However, for DSA, a localized text(label) of the value has precedence over its name. If the label exists for DSA value, then it is returned. Otherwise, DSA object name is returned. | YES | YES | NO |
getDAValue(String dynamicAttributeName) | Similar to getDAValues, only a single value is returned. | YES | YES | NO |
getDSAValueNames(String dynamicAttributeName) | Accept dynamic attribute name as parameter and return dynamic attribute’s configuration values’ name as a list. | YES | YES | NO |
getDSAValueName(String dynamicAttributeName) | Similar to getDSAValueNames, only a single value is returned. | YES | YES | NO |
Expressions to generate PDF and Excel reports
Excel | ||
---|---|---|
Syntax | $P{Quote}.getAttributeValue("quoteId") | ${Quote.getAttributeValue("quoteId")} |
Syntax | $F{SalesItem}.getAttributeValue("isProduct","objectName") | ${SalesItem.getAttributeValue("isProduct","objectName")} |
Dynamic Text | ((BusinessObjectDTO)$P{Quote}.getAttributeValue("hasIncoTerms")).l10nKey | ((BusinessObjectDTO)$P{Quote}.getAttributeValue("hasIncoTerms")).l10nKey |
Static Text | $R{table.label.description} | ${REPORT_RESOURCE_BUNDLE.getString("table.label.description")} |
Date | new SimpleDateFormat("dd.MM.yyyy").format(new java.util.Date()) | new SimpleDateFormat("dd.MM.yyyy").format(new java.util.Date()) |
Condition | Either with the use of printWhenExpression or ternary operator(?). | <jx:if test="${!(attr.attribute.getId().getFragment().matches("has"))}"> </jx:if> |
Iteration | Line items iteration is automatically done in the Detail section. If a user wants to make iteration in the section other than Detail, then they can use List Component. Furthermore, if a user wants to print configuration details, they can use that list component and iterate all configurations. | <jx:forEach items="${SalesItem}" var="salesItem"> </jx:forEach> |
Import class | Allowed | Not allowed |
Declare Variables | Allowed | Not allowed except for variables used in iteration |
Dynamic Image | Supported | Not supported |
Images in reports
The reporting engine enables printing of images that are stored in the system.
- For PDF reports, the engine supports generating dynamic images.
- For XLSX reports, the engine supports generating only static images.
Expressions to generate images
- Fixed image—
$P{CMIS} + "/logos/losgo.png"
- Line item image—
$P{CMIS} + "/" + $F{SalesItem}.getAttributeValues("salesItemImage").get(0)
- Product image—
$P{CMIS} + "/" + $F{SalesItem}.getAttributeValues("isProduct", "productImage").get(0)
Add product attribute range thumbnails to the quote proposal PDFs
In addition to the main product image in the quote proposal PDF, you might also include thumbnails of all product attribute images in that specific quote. This feature enables providing customers with a more rich visual content in the proposal.
To add attribute range thumbnails
- From the application left navigation area, select Administration.
- From the top navigation bar, select Content Management, then select jasperreports.
- Add the image expression to the specific jasperreport template to pull the image information from the product configuration level.
Image expression example:
<imageExpression><![CDATA[$P{CMIS_ROOT} + "/" + $F{SalesItem}.getDSAValueThumbnails("Demo_Product_Country").get(0)]]></imageExpression>
</image>
<image>
<reportElement x="160" y="45" width="25" height="20"/>
<imageExpression><![CDATA[$P{CMIS_ROOT} + "/" + $F{SalesItem}.getDSAValueThumbnails("Demo_Product_Color").get(0)]]></imageExpression>
</image>
Custom fonts in reports
You can select custom fonts to use in your PDF reports. Follow these steps:
- Package selected fonts into
jasper-fonts.jar
- From the application left navigation area, select Administration.
- From the top navigation panel, select Content Management, then select fonts.
- Upload the .jar file.
To generate the .jar file, follow these instructions .
Localization in reports
You can configure a PDF report to print in multiple languages. Follow these steps:
- From the application left navigation area, select Administration.
- From the top navigation panel, select Content Management.
- Select localization, then select report-customization. Each message.properties file defines one language.
Server restart required for changes to take effect.