这是我在jasper.jrxml中的查询:
<queryString>
<![CDATA[SELECT c.id,
b.nom_beneficier,
c.date_saisie,
cat.designation,
c.montant_brut,
c.montant_rs,
c.net_rs,
id_exercice
FROM
crs_certificat c,
crs_beneficier b,
crs_categorie_taux cat
WHERE
c.id_beneficier = b.id
AND c.categorie = cat.id
AND id_exercice = //I want to pass a parameter here
AND c.delete_stat = 0]]>
</queryString>
如何在此查询中加入参数并随时调用它?
修改
这是我声明我的参数但jasper无法看到它的地方:
<subDataset name="tableDataset" uuid="7a7abe40-c5fa-40c9-bc37-a573ee7d748a">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="New Data Adapter "/>
<parameter name="exercice" class="java.lang.Integer"/>
<queryString>
<![CDATA[SELECT c.id, nom_beneficier, date_saisie, designation, montant_brut, montant_rs, net_rs
FROM crs_certificat c, crs_beneficier b, crs_categorie_taux cat
WHERE id_beneficier = b.id and categorie = cat.id AND id_exercice = $P{exercice}]]>
</queryString>
<field name="id" class="java.lang.Integer"/>
<field name="nom_beneficier" class="java.lang.String"/>
<field name="date_saisie" class="java.sql.Date"/>
<field name="designation" class="java.lang.String"/>
<field name="montant_brut" class="java.lang.Double"/>
<field name="montant_rs" class="java.lang.Double"/>
<field name="net_rs" class="java.lang.Double"/>
</subDataset>