抱歉打开这个问题。我想有人告诉我如何归档这个因为ai有同样的问题但我没有得到预期的结果或this问题假设它可能但我不得到同样的。
我将继续我的工作
<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="detailVisitShop" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" scriptletClass="net.sf.jasperreports.engine.JRDefaultScriptlet" uuid="4c82ee8a-2708-4b04-a1f3-b213d6c4c380">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<style name="Title" fontName="Times New Roman" fontSize="50" isBold="true" pdfFontName="Times-Bold"/>
<style name="SubTitle" forecolor="#736343" fontName="Arial" fontSize="18"/>
<style name="Column header" forecolor="#666666" fontName="Arial" fontSize="12" isBold="true"/>
<style name="Detail" fontName="Arial" fontSize="16"/>
<style name="Row" mode="Transparent">
<conditionalStyle>
<conditionExpression><![CDATA[$V{REPORT_COUNT}%2 == 0]]></conditionExpression>
<style backcolor="#E6DAC3"/>
</conditionalStyle>
</style>
<parameter name="idCliente" class="java.lang.Integer">
<defaultValueExpression><![CDATA[3]]></defaultValueExpression>
</parameter>
<parameter name="grpHeader" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[SELECT
Cv.condicionventaname 'CondicionVenta',
concat(Cl.`names`, ' ', Cl.lastnames) 'Cliente',
U.userName 'Operador',
V.fecha,
V.Total,V.idventa,v.cliente_idcliente,
case
when Cv.idcondicionventa = 1 then concat('Folio ', cast(V.folio as char))
else concat('Factura ', cast(V.factura as char))
end as 'Numero de operacion',
case
when V.cars_numberplate is not null then concat('Placas ' , V.cars_numberplate)
when V.climas_idclimas is not null then concat('Numero de serie ', V.climas_idclimas)
end as 'Servicio A', V.cars_numberplate placas,V.climas_idclimas clima,U.userName
from
Ventas V
left join
Climas cli ON Cli.idclimas = V.climas_idclimas
left join
Cars ca ON Ca.numberplate = V.cars_numberplate
left join
condicionventa Cv ON Cv.idcondicionventa = V.condicionventa_idcondicionventa
inner join
cliente Cl ON Cl.idcliente = V.cliente_idcliente
inner join
users U ON U.iduser = V.Users_idUser
order by $P{grpHeader}]]>
</queryString>
<field name="CondicionVenta" class="java.lang.String"/>
<field name="Cliente" class="java.lang.String"/>
<field name="Operador" class="java.lang.String"/>
<field name="fecha" class="java.sql.Timestamp"/>
<field name="Total" class="java.lang.Double"/>
<field name="idventa" class="java.lang.Integer"/>
<field name="cliente_idcliente" class="java.lang.Integer"/>
<field name="Numero de operacion" class="java.lang.String"/>
<field name="Servicio A" class="java.lang.String"/>
<field name="placas" class="java.lang.String"/>
<field name="clima" class="java.lang.String"/>
<field name="userName" class="java.lang.String"/>
<variable name="variable1" class="java.lang.Double" resetType="Group" resetGroup="Group1" calculation="Sum">
<variableExpression><![CDATA[$F{Total}]]></variableExpression>
</variable>
<variable name="groupVal" class="java.lang.Object">
<variableExpression><![CDATA[$P{grpHeader}.equals("Placas") ?
$F{placas} : ($P{grpHeader}.equals("cliente") ? $F{Cliente} : $F{Cliente} )]]></variableExpression>
</variable>
<variable name="numberOfVisits" class="java.lang.Integer" resetType="Group" resetGroup="Group1" calculation="Count">
<variableExpression><![CDATA[$F{idventa}]]></variableExpression>
</variable>
<group name="Group1">
<groupExpression><![CDATA[$P{grpHeader}]]></groupExpression>
<groupHeader>
<band height="37">
<frame>
<reportElement uuid="b6aeacfd-18df-4b4e-8d03-b205cd4e0509" mode="Opaque" x="-21" y="7" width="843" height="24" forecolor="#B89F7D" backcolor="#F2EBDF"/>
<textField>
<reportElement uuid="87ff53e3-0507-4a1a-983d-c25f21767513" style="SubTitle" x="68" y="0" width="755" height="24" forecolor="#736343"/>
<textElement>
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{placas}]]></textFieldExpression>
</textField>
</frame>
</band>
</groupHeader>
<groupFooter>
<band height="26">
<rectangle>
<reportElement uuid="0a5f2335-ad9e-4a8c-8b77-0a2f5ffcfb2d" mode="Opaque" x="-1" y="0" width="802" height="25" forecolor="#FFFFFF" backcolor="#838E8E"/>
</rectangle>
<textField pattern="¤ #,##0.00" isBlankWhenNull="true">
<reportElement uuid="7fb963f9-825a-498f-9635-98614f1f0893" x="559" y="5" width="202" height="20" forecolor="#FFCC00"/>
<textElement>
<font size="14"/>
</textElement>
<textFieldExpression><![CDATA[$V{variable1}]]></textFieldExpression>
</textField>
<textField pattern="¤ #,##0.00" isBlankWhenNull="true">
<reportElement uuid="19e30ce4-bcd7-4763-87c8-20f95a64461a" x="459" y="0" width="100" height="25"/>
<textElement textAlignment="Center" verticalAlignment="Bottom">
<font size="16"/>
</textElement>
<textFieldExpression><![CDATA["Total"]]></textFieldExpression>
</textField>
<textField pattern="¤ #,##0.00" isBlankWhenNull="true">
<reportElement uuid="06e8276f-7143-4c0e-ad9f-336fabbead33" x="1" y="0" width="171" height="25"/>
<textElement verticalAlignment="Middle">
<font size="16"/>
</textElement>
<textFieldExpression><![CDATA["Numero de vistas"]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="true">
<reportElement uuid="e22bb9e4-770e-45cf-b4eb-30d7a0c50633" x="195" y="6" width="202" height="20"/>
<textElement>
<font size="14"/>
</textElement>
<textFieldExpression><![CDATA[$V{numberOfVisits}]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
我还检查了其他来源,如this,但我无法完成目标。所以这是不可能的,或者我做错了?
答案 0 :(得分:0)
如果你不想用参数改变SQL语句,参数的语法有点不同。 在您的示例中,按顺序将订单更改为:
order by $P!{grpHeader}
没有“!”在$ P Jasper将插入格式化的值之后,所以在运行时你会得到像
这样的东西order by "cliente"
而不是
order by cliente
按表达式分组看起来没问题,运行报告时是否会出现任何错误(在更正order by子句后)?