gpt4 book ai didi

jasper-reports - 碧 Jade 表中单列内的多行

转载 作者:行者123 更新时间:2023-12-02 04:54:17 27 4
gpt4 key购买 nike

我只是 jasper 报告的初学者,我被问题困了几天。
我有两张 table

药物 {ID,medication_name}

剂量时间{ID,medication_id,dose_time}

申请

SELECT m.id,m.medication_name,d_t.dose_time FROM medication `m`
LEFT JOIN dose_time d_t ON m.id=d_t.medication_id;

给我三个结果 enter image description here

现在我想要的是关注碧 Jade 报告

enter image description here

但是我可以卡住并且只能生成以下碧 Jade 格式

enter image description here

我的 jrxml 文件如下
<?xml version="1.0" encoding="UTF-8"?>
<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="PracticeReport" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="67dfb372-a5be-403b-9007-61ab07fe88e7">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<subDataset name="Medication" uuid="1cccb880-701b-491e-8094-c133d4bd3819">
<queryString>
<![CDATA[SELECT m.id,m.medication_name,d_t.dose_time FROM medication `m`
LEFT JOIN dose_time d_t ON m.id=d_t.medication_id;]]>
</queryString>
<field name="id" class="java.lang.Integer">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="medication_name" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="dose_time" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<group name="id">
<groupExpression><![CDATA[$F{id}]]></groupExpression>
</group>
</subDataset>
<title>
<band height="79" splitType="Stretch">
<staticText>
<reportElement uuid="8bc54002-3e51-4bd6-8801-9856ef627b99" x="154" y="28" width="240" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Practicing Jasper]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="61" splitType="Stretch"/>
</columnHeader>
<detail>
<band height="125" splitType="Stretch">
<componentElement>
<reportElement uuid="5976a679-e65a-4880-a9e7-74fd65f9e80d" key="" isPrintRepeatedValues="false" x="0" y="0" width="555" height="125">
<printWhenExpression><![CDATA[$V{REPORT_COUNT}==1]]></printWhenExpression>
</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" whenNoDataType="AllSectionsNoDetail">
<datasetRun subDataset="Medication" uuid="5f6c54e4-9c5c-4120-8ac7-32793ec39d00"/>
<jr:column width="232" uuid="c5a6dca0-3be4-422f-8f13-4462d2e4caee">
<jr:detailCell height="124" rowSpan="1">
<textField>
<reportElement uuid="080e50f3-23a0-4bf2-8d6f-b63618dfdc51" isPrintRepeatedValues="false" x="0" y="0" width="232" height="124"/>
<box>
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement/>
<textFieldExpression><![CDATA[$F{id} + ","+$F{medication_name}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="232" uuid="b7bef864-31db-4b77-a929-a0d59e754b36">
<jr:detailCell height="124" rowSpan="1">
<textField>
<reportElement uuid="7b3c68b6-6048-4690-b8e7-14a286f94297" x="0" y="0" width="232" height="124"/>
<box>
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement/>
<textFieldExpression><![CDATA[$F{dose_time}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>

请伙计们,我需要你们的帮助。

最佳答案

您可以为此使用交叉表。转到窗口并单击调色板。调色板会正确显示。最后,将“交叉表”拖到摘要部分并填写向导。

关于jasper-reports - 碧 Jade 表中单列内的多行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24528339/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com