我正在将一个json从spring解析到jaspersoft,所以我做了以下工作:
JSONObject json = new JSONObject();
json.put("t", tickets);
json.put("totalAmount", df.format(totalAmount));
mapper.writeValue(jsonFile, json.toMap());
JsonDataSource source = new JsonDataSource(jsonFile);
JasperPrint print = JasperFillManager.fillReport(report, parameters, source);
这将为我创建一个json,其中包含以下信息:
{
"t": [
{
"id": 5,
"number": 666,
"taxpayer": {
"name": "rodrigo",
"idAtmTaxpayer": null,
"cuit": "20408980675",
"email": "rodrigo.rodriguez@marandu.com.ar"
}
}
],
"totalAmount": "195626,92"
}
所以,我的疑问是:如何在jaspersoft中显示这些信息,而不使用子报表。
如果有人能帮助我,我将非常感激。
jasper的jxrml是:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.16.0.final using JasperReports Library version 6.16.0-48579d909b7943b64690c65c71e07e0b80981928 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="paidTicketsReport.jrxml" pageWidth="612" pageHeight="1008" whenNoDataType="AllSectionsNoDetail" columnWidth="572" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isSummaryWithPageHeaderAndFooter="true" uuid="b92698d7-fb13-42ad-9def-91a4029def19">
<parameter name="gob_logo" class="java.lang.String"/>
<parameter name="ipa_logo" class="java.lang.String"/>
<queryString language="JSON">
<![CDATA[t]]>
</queryString>
<field name="id" class="java.lang.Long">
<fieldDescription><![CDATA[id]]></fieldDescription>
</field>
<field name="number" class="java.lang.Long">
<fieldDescription><![CDATA[number]]></fieldDescription>
</field>
<field name="nameTaxpayer" class="java.lang.String">
<fieldDescription><![CDATA[taxpayer.name]]></fieldDescription>
</field>
<field name="idAtmTaxPayer" class="java.lang.Long">
<fieldDescription><![CDATA[taxpayer.idAtmTaxPayer]]></fieldDescription>
</field>
<field name="cuitTaxpayer" class="java.lang.String">
<fieldDescription><![CDATA[taxpayer.cuit]]></fieldDescription>
</field>
<field name="emailTaxpayer" class="java.lang.String">
<fieldDescription><![CDATA[taxpayer.email]]></fieldDescription>
</field>
<field name="amount" class="java.lang.String">
<fieldDescription><![CDATA[amount]]></fieldDescription>
</field>
1条答案
按热度按时间ojsjcaue1#
放
TextFields
其表达式等于您的字段,例如。$F{idAtmTaxPayer}
在你报告的某个波段,例如细节波段。这对我有用。显然,因为使用t作为数据的根,“totalamount”字段将不起作用。