Generating reports
  • 09 Aug 2024
  • 5 Minutes to read
  • Dark
    Light

Generating reports

  • Dark
    Light

Article summary

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"
            }
        ]
    }
}
Tips
  • 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 NameData TypeUsage
Quote (Parameter)com.imc.datamodel.transferobjects.BusinessObjectDTOGets the quote header information.
SalesItem (Field)com.imc.datamodel.transferobjects.BusinessObjectDTOGets information about a line item.
CMIS (Parameter)java.lang.StringDisplays images.
REPORT_LOCALE (Parameter)java.util.LocaleCurrent locale for which the report is generated.
REPORT_RESOURCE_BUNDLE (Parameter)java.util.ResourceBundleResource bundle that is bonded with the report.
currentDate (Parameter)java.lang.StringToday's date, in DD_MM_YYYY format.
VAR_LOGGED_IN_USER (Parameter)java.lang.StringCurrently logged in username.
VAR_LOGGED_IN_USER_ROLE (Parameter)java.lang.StringCurrently logged in user role.
SUBREPORT_XXXXXX, where XXXXXX is the sub-report name (Parameter)net.sf.jasperreports.engine.JasperReportOptional. 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.

MethodDetailsPDFExcelDeprecated
getAttribute(String fragment)Accept a single fragment as a parameter. Useful for getting attribute information such as l10nKey.YESYESNO
getAttributeLongValue(final String fragment)Accept a single fragment as parameter. Useful for getting a long description of an attribute.YESYESYES
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.YESNONO
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.YESYESNO
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.YESNONO
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.YESYESNO
getDALabel(String dynamicAttributeName)Accept dynamic attribute name as parameter and return label(l10nkey) of dynamic attribute.YESYESNO
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.YESYESNO
getDAValue(String dynamicAttributeName)Similar to getDAValues, only a single value is returned.YESYESNO
getDSAValueNames(String dynamicAttributeName)Accept dynamic attribute name as parameter and return dynamic attribute’s configuration values’ name as a list.YESYESNO
getDSAValueName(String dynamicAttributeName)Similar to getDSAValueNames, only a single value is returned.YESYESNO

Expressions to generate PDF and Excel reports

PDFExcel
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")}
Datenew SimpleDateFormat("dd.MM.yyyy").format(new java.util.Date())new SimpleDateFormat("dd.MM.yyyy").format(new java.util.Date())
ConditionEither with the use of printWhenExpression or ternary operator(?).<jx:if test="${!(attr.attribute.getId().getFragment().matches("has"))}"> </jx:if>
IterationLine 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 classAllowedNot allowed
Declare VariablesAllowedNot allowed except for variables used in iteration
Dynamic ImageSupportedNot 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

  1. From the application left navigation area, select Administration.
  2. From the top navigation bar, select Content Management, then select jasperreports.
  3. 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:

  1. Package selected fonts into jasper-fonts.jar
  2. From the application left navigation area, select Administration.
  3. From the top navigation panel, select Content Management, then select fonts.
  4. 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:

  1. From the application left navigation area, select Administration.
  2. From the top navigation panel, select Content Management.
  3. Select localization, then select report-customization. Each message.properties file defines one language.
Tip

Server restart required for changes to take effect.


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.