Jasper 根据子条件在 table 中报告多级属性

Jasper report multilevel attribute in table based on child condition

如何在 jasper 报告中使用以下数据生成以下 table。 它应该过滤掉 value=Yes

的行
Name state
SD1 Yes
SD3 Yes

xml数据

<data>
<c_data>
<quote_driver_full_name>SD1 </quote_driver_full_name>
<create_state>
<value>Yes</value>
</create_state>
</c_data>
<c_data>
<quote_driver_full_name>SD2 </quote_driver_full_name>
<create_state>
<value>No</value>
</create_state>
</c_data>
<c_data>
<quote_driver_full_name>SD3</quote_driver_full_name>
<create_state>
<value>Yes</value>
</create_state>
</c_data>
</data>

这是上面的代码,它不打印任何内容 value_create 或 value_create1。我需要 value_create 的值,以便我可以将其用于 printexpression 条件

<style name="noBorder"/>
    <subDataset name="driver_details" uuid="123c4f48-1cc9-4bd6-8350-f9e9ebe20e74">
        <queryString language="xPath">
            <![CDATA[/data/c_data]]>
        </queryString>
        <field name="quote_driver_full_name" class="java.lang.String">
            <fieldDescription><![CDATA[data/c_data/quote_driver_full_name]]></fieldDescription>
        </field>
        <field name="quote_driver_full_name1" class="java.lang.String">
            <fieldDescription><![CDATA[quote_driver_full_name]]></fieldDescription>
        </field>
        <field name="value_create" class="java.lang.String">
            <fieldDescription><![CDATA[data/c_data/create_state/value]]></fieldDescription>
        </field>
        <field name="value_create1" class="java.lang.String">
            <fieldDescription><![CDATA[value_create]]></fieldDescription>
        </field>
    </subDataset>

<detail>
        <band height="670" splitType="Stretch">
            <frame>
                <reportElement style="table" positionType="Float" x="3" y="49" width="546" height="441" uuid="4bf9e6ee-0faa-458c-9d98-96ee2936be2a"/>
                <componentElement>
                    <reportElement key="table 6" x="3" y="13" width="497" height="50" uuid="462397c6-bb2d-4a70-a568-0d34b8ef9bde"/>
                    <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="driver_details" uuid="a856c3e2-4cac-4df0-b0b3-83d9c4d3be5a">
                            <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/data/c_data")]]></dataSourceExpression>
                        </datasetRun>
                        <jr:column width="490" uuid="fbc10a2f-9507-453e-bf9e-714df6349e71">
                            <jr:columnHeader height="30" rowSpan="1">
                                <staticText>
                                    <reportElement x="0" y="0" width="490" height="30" uuid="760bf14a-a63e-452f-b8d0-863ba993d174"/>
                                    <text><![CDATA[Named Drivers]]></text>
                                </staticText>
                            </jr:columnHeader>
                            <jr:detailCell style="noBorder" height="20" rowSpan="1">
                                <textField>
                                    <reportElement x="0" y="0" width="490" height="20" uuid="2f8004da-a095-4eff-928b-ec955cad7622"/>
                                    <textFieldExpression><![CDATA[$F{quote_driver_full_name1}+":"+$F{value_create}+":"+$F{value_create1}]]></textFieldExpression>
                                </textField>
                            </jr:detailCell>
                        </jr:column>
                    </jr:table>
                </componentElement>

下面的代码对我有用:

<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="Blank_A4" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="06c9e4c1-e2b4-439f-ba31-34af21752050">
<queryString language="XPath">
    <![CDATA[/data/c_data]]>
</queryString>
<field name="quote_driver_full_name" class="java.lang.String">
    <property name="net.sf.jasperreports.xpath.field.expression" value="quote_driver_full_name"/>
    <fieldDescription><![CDATA[quote_driver_full_name]]></fieldDescription>
</field>
<field name="value" class="java.lang.String">
    <property name="net.sf.jasperreports.xpath.field.expression" value="create_state/value"/>
    <fieldDescription><![CDATA[create_state/value]]></fieldDescription>
</field>
<filterExpression><![CDATA[EQUALS($F{value},"Yes")]]></filterExpression>
<columnHeader>
    <band height="30">
        <staticText>
            <reportElement x="0" y="0" width="278" height="30" uuid="9b6bd2fe-141e-4131-a4ca-700691be40c0">
                <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="3049b5c8-2084-42b0-b5ca-dd6c4a48eb47"/>
            </reportElement>
            <text><![CDATA[NAME]]></text>
        </staticText>
        <staticText>
            <reportElement x="278" y="0" width="277" height="30" uuid="8033edee-5668-431c-92b2-d21249d970e0">
                <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="c714b3bc-a2af-4483-8e8f-815c2c9c9221"/>
            </reportElement>
            <text><![CDATA[STATE]]></text>
        </staticText>
    </band>
</columnHeader>
<detail>
    <band height="30" splitType="Stretch">
        <textField>
            <reportElement x="0" y="0" width="278" height="30" uuid="45a762be-e99f-470e-93b0-8f61f0a9ac26">
                <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="3049b5c8-2084-42b0-b5ca-dd6c4a48eb47"/>
            </reportElement>
            <textFieldExpression><![CDATA[$F{quote_driver_full_name}]]></textFieldExpression>
        </textField>
        <textField>
            <reportElement x="278" y="0" width="277" height="30" uuid="b9b6d480-3285-41d0-a143-6a4625c4af11">
                <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="c714b3bc-a2af-4483-8e8f-815c2c9c9221"/>
            </reportElement>
            <textFieldExpression><![CDATA[$F{value}]]></textFieldExpression>
        </textField>
    </band>
</detail>