Java - Problema con Informe de JasperReport

 
Vista:
Imágen de perfil de Juan
Val: 30
Ha aumentado 1 puesto en Java (en relación al último mes)
Gráfica de Java

Problema con Informe de JasperReport

Publicado por Juan (16 intervenciones) el 17/09/2020 19:02:00
Buenas tardes Foro,
Mi primera intervención es para ver si podeis hecharme una mano con un problema que tengo con un reporte hecho con JasperReport que conecta con una base de datos.
Pasos :
1.- Hacer la conexion a la base de datos y testearla.
2.- Hacer el informe con el SQL correspondiente y para probar el parametro de entrada lo pongo como un literal ( valor fijo ).
3.- De esta forma veo que funciona el SQL y que recupera los datos del registro en cuestión.
4.- en mi programa Java implemento la acción para llamar al jrxml que he generado pasandole el dato que quiero.
5.- en el informe el dato parametro tambien lo imprimo porque es el numero de documento y quiero que se vea.
6.- si ejecuto desde mi programa el parametro se debe pasar correctamente porque lo veo impreso así como el Logo, cuadrados, Nº de página y fecha pero los campos que debería recuperar el SQL en la base de datos aparecen todos como NULL y no consigo entender porque si el parámetro llega correcto porque lo imprime NO ejecura el SQL del jrxml ......

Os pego el Jrxml, el parametro de entrada es el "numeroContacto"

GRACIAS de antemano.

-------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.8.0.final using JasperReports Library version 6.8.0-2ed8dfabb690ff337a5797129f2cd92902b0c87b -->
<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="Ficha_Contacto" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isIgnorePagination="true" uuid="086d2510-2408-438d-a59f-74e36cf250b9">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="CRM_Contactos"/>
<property name="com.jaspersoft.studio.property.dataset.dialog.DatasetDialog.sash.w1" value="658"/>
<property name="com.jaspersoft.studio.property.dataset.dialog.DatasetDialog.sash.w2" value="328"/>
<property name="com.jaspersoft.studio.data.sql.SQLQueryDesigner.sash.w1" value="341"/>
<property name="com.jaspersoft.studio.data.sql.SQLQueryDesigner.sash.w2" value="652"/>
<parameter name="numeroContacto" class="java.lang.Integer" isForPrompting="false">
<defaultValueExpression><![CDATA[0]]></defaultValueExpression>
</parameter>
<queryString language="SQL">
<![CDATA[SELECT "CRM"."CONTACTOS"."NUMERO",
"CRM"."CONTACTOS"."NOMBRE",
"CRM"."CONTACTOS"."FECHAALTA",
"CRM"."CONTACTOS"."DIRECCION",
"CRM"."CONTACTOS"."CODIGOPOSTAL",
"CRM"."CONTACTOS"."CIUDAD",
"CRM"."CONTACTOS"."PROVINCIA",
"CRM"."CONTACTOS"."PAIS",
"CRM"."CONTACTOS"."EMAIL",
"CRM"."CONTACTOS"."TELEFONO",
"CRM"."CONTACTOS"."MOVIL",
"CRM"."CONTACTOS"."CONTACTO",
"CRM"."CONTACTOS"."OBSERVACIONES",
"CRM"."CONTACTOS"."DISCUSION",
"CRM"."CONTACTOS"."CATEGORIA_OID",
"CRM"."CONTACTOS"."STATUS_OID",
"CRM"."CONTACTOS"."SECTOR_OID",
"CRM"."STATUS"."OID",
"CRM"."STATUS"."DESCRIPCION",
"CRM"."SECTOR"."OID",
"CRM"."SECTOR"."DESCRIPCION",
"CRM"."CATEGORIA"."OID",
"CRM"."CATEGORIA"."DESCRIPCION"
FROM "CRM"."CONTACTOS",
"CRM"."STATUS",
"CRM"."SECTOR",
"CRM"."CATEGORIA"
WHERE
"CRM"."CONTACTOS"."NUMERO" = $P{numeroContacto}
AND "CRM"."CONTACTOS"."CATEGORIA_OID" = "CRM"."CATEGORIA"."OID"
AND "CRM"."CONTACTOS"."STATUS_OID" = "CRM"."STATUS"."OID"
AND "CRM"."CONTACTOS"."SECTOR_OID" = "CRM"."SECTOR"."OID"]]>
</queryString>
<field name="NUMERO" class="java.lang.Integer">
<property name="com.jaspersoft.studio.field.label" value="NUMERO"/>
<property name="com.jaspersoft.studio.field.tree.path" value="CONTACTOS"/>
</field>
<field name="NOMBRE" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="NOMBRE"/>
<property name="com.jaspersoft.studio.field.tree.path" value="CONTACTOS"/>
</field>
<field name="FECHAALTA" class="java.sql.Date">
<property name="com.jaspersoft.studio.field.label" value="FECHAALTA"/>
<property name="com.jaspersoft.studio.field.tree.path" value="CONTACTOS"/>
</field>
<field name="DIRECCION" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="DIRECCION"/>
<property name="com.jaspersoft.studio.field.tree.path" value="CONTACTOS"/>
</field>
<field name="CODIGOPOSTAL" class="java.lang.Integer">
<property name="com.jaspersoft.studio.field.label" value="CODIGOPOSTAL"/>
<property name="com.jaspersoft.studio.field.tree.path" value="CONTACTOS"/>
</field>
<field name="CIUDAD" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="CIUDAD"/>
<property name="com.jaspersoft.studio.field.tree.path" value="CONTACTOS"/>
</field>
<field name="PROVINCIA" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="PROVINCIA"/>
<property name="com.jaspersoft.studio.field.tree.path" value="CONTACTOS"/>
</field>
<field name="PAIS" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="PAIS"/>
<property name="com.jaspersoft.studio.field.tree.path" value="CONTACTOS"/>
</field>
<field name="EMAIL" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="EMAIL"/>
<property name="com.jaspersoft.studio.field.tree.path" value="CONTACTOS"/>
</field>
<field name="TELEFONO" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="TELEFONO"/>
<property name="com.jaspersoft.studio.field.tree.path" value="CONTACTOS"/>
</field>
<field name="MOVIL" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="MOVIL"/>
<property name="com.jaspersoft.studio.field.tree.path" value="CONTACTOS"/>
</field>
<field name="CONTACTO" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="CONTACTO"/>
<property name="com.jaspersoft.studio.field.tree.path" value="CONTACTOS"/>
</field>
<field name="OBSERVACIONES" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="OBSERVACIONES"/>
<property name="com.jaspersoft.studio.field.tree.path" value="CONTACTOS"/>
</field>
<field name="DISCUSION" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="DISCUSION"/>
<property name="com.jaspersoft.studio.field.tree.path" value="CONTACTOS"/>
</field>
<field name="CATEGORIA_OID" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="CATEGORIA_OID"/>
<property name="com.jaspersoft.studio.field.tree.path" value="CONTACTOS"/>
</field>
<field name="STATUS_OID" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="STATUS_OID"/>
<property name="com.jaspersoft.studio.field.tree.path" value="CONTACTOS"/>
</field>
<field name="SECTOR_OID" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="SECTOR_OID"/>
<property name="com.jaspersoft.studio.field.tree.path" value="CONTACTOS"/>
</field>
<field name="OID" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="OID"/>
<property name="com.jaspersoft.studio.field.tree.path" value="STATUS"/>
</field>
<field name="DESCRIPCION" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="DESCRIPCION"/>
<property name="com.jaspersoft.studio.field.tree.path" value="STATUS"/>
</field>
<field name="COLUMN_20" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="OID"/>
<property name="com.jaspersoft.studio.field.tree.path" value="SECTOR"/>
</field>
<field name="COLUMN_21" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="DESCRIPCION"/>
<property name="com.jaspersoft.studio.field.tree.path" value="SECTOR"/>
</field>
<field name="COLUMN_22" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="OID"/>
<property name="com.jaspersoft.studio.field.tree.path" value="CATEGORIA"/>
</field>
<field name="COLUMN_23" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="DESCRIPCION"/>
<property name="com.jaspersoft.studio.field.tree.path" value="CATEGORIA"/>
</field>



<title>


<reportElement x="462" y="-10" width="100" height="70" uuid="268f9d36-acdd-49f6-9508-460107ede191">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<![CDATA["C:/JPB/ISGAL/Logo_Nuevo/Logo_Renuevo_Pequeño.jpg"]]>

<textField>
<reportElement positionType="FixRelativeToBottom" isPrintRepeatedValues="false" x="199" y="39" width="290" height="30" forecolor="#59504F" uuid="cc91a2e8-a46f-480e-9171-6a1e9b2e110b"/>
<textElement>
<font fontName="Arial" size="20" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{NOMBRE}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement x="0" y="-3" width="154" height="23" uuid="d741f4d2-b8b8-4805-9a98-98090708d4c1"/>
</rectangle>
<textField>
<reportElement positionType="FixRelativeToBottom" isPrintRepeatedValues="false" x="129" y="1" width="25" height="30" forecolor="#59504F" uuid="2fdb133c-0108-4e7a-a023-2c8e6a4c2698"/>
<textElement>
<font fontName="Arial" size="12" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{numeroContacto}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="8" y="1" width="112" height="30" uuid="82d2be58-f0c9-4f4b-b2be-2b06943901b8"/>
<textElement>
<font fontName="Arial" size="12"/>
</textElement>
<text><![CDATA[Ficha - Contacto Nº.:]]></text>
</staticText>

</title>
<pageHeader>

<rectangle>
<reportElement x="0" y="10" width="230" height="97" uuid="1e6d569b-c183-4021-8890-6f43f7656a75"/>
</rectangle>
<staticText>
<reportElement x="50" y="36" width="30" height="30" uuid="b0139b56-3ad2-4a82-9222-5395f86a0f06"/>
<textElement>
<font fontName="Arial" size="16"/>
</textElement>
<text><![CDATA[-]]></text>
</staticText>
<textField>
<reportElement positionType="FixRelativeToBottom" isPrintRepeatedValues="false" x="10" y="15" width="207" height="30" forecolor="#59504F" uuid="77a6dd06-ed25-4379-ad43-a6b380701652"/>
<textElement>
<font fontName="Arial" size="16" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{DIRECCION}]]></textFieldExpression>
</textField>
<textField>
<reportElement positionType="FixRelativeToBottom" isPrintRepeatedValues="false" x="80" y="36" width="40" height="30" forecolor="#59504F" uuid="e9579bdd-8763-4c10-b6da-9f7f266d0640"/>
<textElement>
<font fontName="Arial" size="16" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{CIUDAD}]]></textFieldExpression>
</textField>
<textField>
<reportElement positionType="FixRelativeToBottom" isPrintRepeatedValues="false" x="10" y="36" width="40" height="30" forecolor="#59504F" uuid="290cf7be-1e02-4753-8a9e-3d9754752017"/>
<textElement>
<font fontName="Arial" size="16" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{CODIGOPOSTAL}]]></textFieldExpression>
</textField>
<textField>
<reportElement positionType="FixRelativeToBottom" isPrintRepeatedValues="false" x="9" y="56" width="208" height="30" forecolor="#59504F" uuid="75d679a1-d8ee-4fe7-843f-3c4930f9b4c9"/>
<textElement>
<font fontName="Arial" size="16" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{PROVINCIA}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement x="310" y="10" width="230" height="160" uuid="2ba27fd4-f911-4ef5-b926-b73f5060c048"/>
</rectangle>
<textField>
<reportElement positionType="FixRelativeToBottom" isPrintRepeatedValues="false" x="315" y="41" width="125" height="30" forecolor="#59504F" uuid="4b792152-9c48-4a2f-a436-1d823439b79b"/>
<textElement>
<font fontName="Arial" size="16" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{TELEFONO}]]></textFieldExpression>
</textField>
<textField>
<reportElement positionType="FixRelativeToBottom" isPrintRepeatedValues="false" x="450" y="41" width="87" height="30" forecolor="#59504F" uuid="77eacf45-51bc-4299-85a1-9ee2c53d34fb"/>
<textElement>
<font fontName="Arial" size="16" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{MOVIL}]]></textFieldExpression>
</textField>
<textField>
<reportElement positionType="FixRelativeToBottom" isPrintRepeatedValues="false" x="315" y="62" width="207" height="30" forecolor="#59504F" uuid="7052819d-948e-432d-871b-1ff59eb8fd1e"/>
<textElement>
<font fontName="Arial" size="16" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{EMAIL}]]></textFieldExpression>
</textField>
<textField>
<reportElement positionType="FixRelativeToBottom" isPrintRepeatedValues="false" x="315" y="87" width="207" height="30" forecolor="#59504F" uuid="8da464ae-9ccc-4e9a-8680-60cd5ba15b64"/>
<textElement>
<font fontName="Arial" size="16" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{CONTACTO}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement x="310" y="10" width="60" height="24" uuid="aa739bfd-0ce1-4d4d-a0a0-6174993d4fa3"/>
</rectangle>
<textField>
<reportElement positionType="FixRelativeToBottom" isPrintRepeatedValues="false" x="320" y="14" width="50" height="24" forecolor="#59504F" uuid="4c8b4255-f510-4be3-8485-d281e5f122eb"/>
<textElement>
<font fontName="Arial" size="12" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{FECHAALTA}]]></textFieldExpression>
</textField>
<line>
<reportElement x="310" y="84" width="230" height="1" uuid="6de13444-316a-4942-aade-2b399c74759b"/>
</line>
<textField>
<reportElement positionType="FixRelativeToBottom" isPrintRepeatedValues="false" x="315" y="104" width="207" height="30" forecolor="#59504F" uuid="a81d21dd-c6c2-4670-8cfd-e69e4d6a39a9"/>
<textElement>
<font fontName="Arial" size="16" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{DESCRIPCION}]]></textFieldExpression>
</textField>
<textField>
<reportElement positionType="FixRelativeToBottom" isPrintRepeatedValues="false" x="316" y="121" width="207" height="30" forecolor="#59504F" uuid="3e55ac87-7a74-4e81-a649-9e18a9a73d73"/>
<textElement>
<font fontName="Arial" size="16" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{COLUMN_21}]]></textFieldExpression>
</textField>
<textField>
<reportElement positionType="FixRelativeToBottom" isPrintRepeatedValues="false" x="316" y="138" width="207" height="22" forecolor="#59504F" uuid="62398299-cfeb-4594-9874-7986a7e7782a"/>
<textElement>
<font fontName="Arial" size="16" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{COLUMN_23}]]></textFieldExpression>
</textField>
<textField>
<reportElement positionType="FixRelativeToBottom" isPrintRepeatedValues="false" x="9" y="79" width="208" height="30" forecolor="#59504F" uuid="3f725ab8-a099-4151-8f26-d61a3207d3c1"/>
<textElement>
<font fontName="Arial" size="16" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{PAIS}]]></textFieldExpression>
</textField>

</pageHeader>
<columnHeader>

<rectangle>
<reportElement x="0" y="100" width="540" height="126" uuid="a474113c-a938-4710-b143-4279d1994746"/>
</rectangle>
<textField>
<reportElement positionType="FixRelativeToBottom" isPrintRepeatedValues="false" x="10" y="106" width="517" height="114" forecolor="#59504F" uuid="5770a232-6569-4bda-baf4-5ae359b8d2b1"/>
<textElement>
<font fontName="Arial" size="16" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{OBSERVACIONES}]]></textFieldExpression>
</textField>

</columnHeader>
<columnFooter>

<rectangle>
<reportElement x="0" y="-120" width="550" height="150" uuid="8305413f-53bf-4d6a-a55b-1f12e061a638"/>
</rectangle>
<rectangle>
<reportElement x="0" y="-120" width="70" height="30" uuid="909c278d-916f-4fe7-9bf7-4c2a3595d461"/>
</rectangle>
<staticText>
<reportElement x="8" y="-111" width="62" height="25" uuid="6e66555c-4a99-4363-a68c-1ef92bd1aec1"/>
<textElement>
<font fontName="Arial" size="14" isBold="true"/>
</textElement>
<text><![CDATA[NOTAS :]]></text>
</staticText>

</columnFooter>
<pageFooter>

<textField pattern="MMMMM dd, yyyy">
<reportElement x="8" y="2" width="100" height="30" uuid="81dcdbe8-4c93-4b8b-a2fc-b8e19196a8fe"/>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
<textField>
<reportElement x="463" y="2" width="100" height="30" uuid="5ac501d9-7d8e-43ec-ba5d-0d3026f3add9"/>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>

</pageFooter>
<summary>

</summary>
</jasperReport>
--------------------------------------------------
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder