daust / JasperReportsIntegration

JasperReportsIntegration provides an interface to use the JasperReports reporting engine in an Oracle database application, specifically with Oracle Application Express (Oracle APEX).
BSD 3-Clause "New" or "Revised" License
56 stars 26 forks source link

Report Parameter Data type Integer (java.lang.String cannot be cast to java.lang.Integer) #56

Closed HAfsari closed 4 years ago

HAfsari commented 4 years ago

Parameter Data Type Custing Error

image

Also, Jasper SCRIPTLET Integer type parameter Casting Conver Error

image

daust commented 4 years ago
  1. Can you upload the report definition? Or ideally build a simplified test case which I can run locally?
  2. Is this a new issue with the new release and was working before? Or is this a new / changed report?
  3. Is it possible that the parameter is defined as Number/Integer? The integration can ONLY work with "String". In the sql query you would use to_number() to use it as a number.
HAfsari commented 4 years ago

Parameter paudit_id Integer

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.11.0.final using JasperReports Library version 6.11.0-0c4056ccaa4d25a5a8c45672d2f764ea3498bebb  -->
<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="test" pageWidth="595" pageHeight="842" whenNoDataType="BlankPage" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="2f5542fa-3633-4ed3-b168-f3ac22a02298">
    <property name="com.jaspersoft.studio.data.sql.tables" value=""/>
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="TAHQIQ_DEV"/>
    <scriptlet name="REPORT_TAHQIQ" class="com.mislbd.tahqiq.TahqiqScriptlet">
        <scriptletDescription><![CDATA[Tahqiq Java Project Report Application]]></scriptletDescription>
    </scriptlet>
    <parameter name="paudit_id" class="java.lang.Integer"/>
    <queryString language="SQL">
        <![CDATA[select 'AAAAAAAAAAAAAAA'  DATA from DUAL where 1 = $P{paudit_id}]]>
    </queryString>
    <field name="DATA" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.label" value="DATA"/>
    </field>
    <background>
        <band splitType="Stretch"/>
    </background>
    <detail>
        <band height="30" splitType="Stretch">
            <textField textAdjust="StretchHeight" isBlankWhenNull="true">
                <reportElement stretchType="ContainerBottom" x="0" y="0" width="555" height="30" isPrintWhenDetailOverflows="true" uuid="8a4962c6-398f-4d6f-9c36-e33e4e9270c2">
                    <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="97b0d215-6655-4d49-b3d2-c09c736c21a4"/>
                </reportElement>
                <box>
                    <pen lineWidth="0.25"/>
                </box>
                <textElement textAlignment="Center">
                    <font fontName="Times New Roman" size="14"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{DATA}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
</jasperReport>
daust commented 4 years ago

Hi @HAfsari, as I said before and like the documentation states, only parameters of type STRING are allowed, you are using Integer. This is currently unsupported.

https://github.com/daust/JasperReportsIntegration/blob/master/src/doc/github/integration-usage.md

image