I’ve some reports made in Jaspersoft Studio, these reports I created these using parameters and these reports work perfectly. Now I’m currently trying to make a report that uses a table with parameters but I’m problem to do this. I’ve created in both dataset dialog screen main report and table my select, I’ve created too in main report and table the parameter to use, when I put the where condition in the main report the where condition isn’t respected and all data of my db table is displayed if I put this condition in the dataset screen of the table nothing is dysplayed.
Here is a test table with only one column:
<!-- Created with Jaspersoft Studio version 6.20.0.final using JasperReports Library version 6.20.0-2bc7ab61c56f459e8176eb05c7705e145cd400ad -->
<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="TstTabl1" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="1b9c97d8-41f8-486c-984e-c48379a9e5cc">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="ITC Data Adapter"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<style name="Table_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="Dataset1" uuid="b3e4477e-a43b-4f56-92a2-83d28f070306">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="ITC Data Adapter"/>
<parameter name="paramResp" class="java.lang.String">
<defaultValueExpression><![CDATA[$P{paramResp}]]></defaultValueExpression>
</parameter>
<queryString language="SQL">
<![CDATA[SELECT `Nome`,
`Medico_Responsavel`
FROM db_medical.tabela_cadastro_pacientes
]]>
</queryString>
<field name="Nome" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="Nome"/>
<property name="com.jaspersoft.studio.field.label" value="Nome"/>
<property name="com.jaspersoft.studio.field.tree.path" value="tabela_cadastro_pacientes"/>
</field>
<field name="Medico_Responsavel" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="Medico_Responsavel"/>
<property name="com.jaspersoft.studio.field.label" value="Medico_Responsavel"/>
<property name="com.jaspersoft.studio.field.tree.path" value="tabela_cadastro_pacientes"/>
</field>
</subDataset>
<parameter name="paramResp" class="java.lang.String">
<defaultValueExpression><![CDATA[$P{paramResp}]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[SELECT `Nome`,
`Medico_Responsavel`
FROM db_medical.tabela_cadastro_pacientes
WHERE Medico_Responsavel = $P{paramResp}]]>
</queryString>
<field name="Nome" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="Nome"/>
<property name="com.jaspersoft.studio.field.label" value="Nome"/>
<property name="com.jaspersoft.studio.field.tree.path" value="tabela_cadastro_pacientes"/>
</field>
<field name="Medico_Responsavel" class="java.lang.String">
<property name="com.jaspersoft.studio.field.name" value="Medico_Responsavel"/>
<property name="com.jaspersoft.studio.field.label" value="Medico_Responsavel"/>
<property name="com.jaspersoft.studio.field.tree.path" value="tabela_cadastro_pacientes"/>
</field>
<background>
<band splitType="Stretch"/>
</background>
<summary>
<band height="209" splitType="Stretch">
<componentElement>
<reportElement x="288" y="9" width="200" height="200" uuid="2f19cb5b-78fb-4c9a-9ecf-c00f275575d8">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
<property name="com.jaspersoft.studio.table.style.table_header" value="Table_TH"/>
<property name="com.jaspersoft.studio.table.style.column_header" value="Table_CH"/>
<property name="com.jaspersoft.studio.table.style.detail" value="Table_TD"/>
</reportElement>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="Dataset1" uuid="3e0b2ac7-6325-4739-a543-771cc60b361b">
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
<jr:column width="200" uuid="a507d065-3270-4fa3-b6a9-027f41a770e2">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/>
<jr:columnHeader style="Table_CH" height="30">
<staticText>
<reportElement x="0" y="0" width="200" height="30" uuid="8391f904-7008-4969-94d3-b618a62ce66d"/>
<text><![CDATA[Nome]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField>
<reportElement x="0" y="0" width="200" height="30" uuid="3f2ab338-b132-45ab-b47a-9bdef8cef97d"/>
<textFieldExpression><![CDATA[$F{Nome}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</summary>
</jasperReport>
I’ll apreciate any assistance.
Thanks and best regards.