#1 2021-05-26 06:03:35

twolsey
Member
Registered: 2019-01-13

JasperReport error when using String functions Like Mid, Replace

Hello

I am trying to use some simple java string functions in a variable field but it is generating an error in ReportServer.  The report generates properly in JasperStudio but not in ReportServer.

The report could not be executed: Could not execute report: Errors were encountered when compiling report expressions class file: 1. The method MID(String, int, int) is undefined for the type WTEDGEMasterDILoopTest_1622012519922_647989 value = MID(((java.lang.String)field_tag.getValue()),2,1).contains("S" )?REPLACE(((java.lang.String)field_tag.getValue()),2,1,"A"):MID(((java.lang.String)field_tag.getValue()),2,2).contains("ZS" )?REPLACE(((java.lang.String)field_tag.getValue()),2,2,"ZA"):((java.lang.String)field_tag.getValue()); //$JR_EXPR_ID=10$ <-> 2. The method REPLACE(String, int, int, String) is undefined for the type WTEDGEMasterDILoopTest_1622012519922_647989 value = MID(((java.lang.String)field_tag.getValue()),2,1).contains("S" )?REPLACE(((java.lang.String)field_tag.getValue()),2,1,"A"):MID(((java.lang.String)field_tag.getValue()),2,2).contains("ZS" )? .......


thanks
Tony

Last edited by twolsey (2021-05-26 07:03:14)

Offline

#2 2021-05-26 08:47:22

eduardo
Administrator
Registered: 2016-11-01
Website

Re: JasperReport error when using String functions Like Mid, Replace

Hi Tony,

for being able to reproduce this, we need a minimal example with a dummy sql or a sql on the internal or demo data datasource. Pls. delete everything unnecessary and post your jasper report here.

Regards,
Eduardo

Offline

#3 2021-05-27 02:25:08

twolsey
Member
Registered: 2019-01-13

Re: JasperReport error when using String functions Like Mid, Replace

Hi Eduardo

Please see below for a simplified Jaspersoft report that will display properly in JasperStudio but not in Reportserver. Not sure how to send you the accompanying MySql db as I cannot attach anything here??

thanks
Tony

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.16.0.final using JasperReports Library version 6.16.0-48579d909b7943b64690c65c71e07e0b80981928  -->
<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="WTEDGEMasterDILoopTest" pageWidth="612" pageHeight="792" columnWidth="572" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="10" uuid="42d79c5e-37db-4d18-9312-3b40257077b6">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="LinuxWTEDGETestDA_HST"/>
    <property name="com.jaspersoft.studio.data.sql.tables" value=""/>
    <property name="com.jaspersoft.studio.unit." value="pixel"/>
    <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
    <property name="com.jaspersoft.studio.report.description" value=""/>
    <property name="com.jaspersoft.studio.property.dataset.dialog.DatasetDialog.sash.w1" value="437"/>
    <property name="com.jaspersoft.studio.property.dataset.dialog.DatasetDialog.sash.w2" value="553"/>
    <parameter name="TagName" class="java.lang.String" isForPrompting="false"/>
    <parameter name="ProjectNumber" class="java.lang.String"/>
    <queryString>
        <![CDATA[Select Distinct
tblindex.*, tblprojectdetails.*
from tblindex, tblprojectdetails
Where tblprojectdetails.projectnumber = $P{ProjectNumber}
And tblindex.project = $P{ProjectNumber}]]>
    </queryString>
    <field name="id" class="java.lang.Integer">
        <property name="com.jaspersoft.studio.field.name" value="id"/>
        <property name="com.jaspersoft.studio.field.label" value="id"/>
        <property name="com.jaspersoft.studio.field.tree.path" value="tblindex"/>
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="project" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.name" value="project"/>
        <property name="com.jaspersoft.studio.field.label" value="project"/>
        <property name="com.jaspersoft.studio.field.tree.path" value="tblindex"/>
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="tag" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.name" value="tag"/>
        <property name="com.jaspersoft.studio.field.label" value="tag"/>
        <property name="com.jaspersoft.studio.field.tree.path" value="tblindex"/>
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="iotype" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.name" value="iotype"/>
        <property name="com.jaspersoft.studio.field.label" value="iotype"/>
        <property name="com.jaspersoft.studio.field.tree.path" value="tblindex"/>
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="projectnumber" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.name" value="projectnumber"/>
        <property name="com.jaspersoft.studio.field.label" value="projectnumber"/>
        <property name="com.jaspersoft.studio.field.tree.path" value="tblprojectdetails"/>
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="projectclient" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.name" value="projectclient"/>
        <property name="com.jaspersoft.studio.field.label" value="projectclient"/>
        <property name="com.jaspersoft.studio.field.tree.path" value="tblprojectdetails"/>
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="projectlocation" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.name" value="projectlocation"/>
        <property name="com.jaspersoft.studio.field.label" value="projectlocation"/>
        <property name="com.jaspersoft.studio.field.tree.path" value="tblprojectdetails"/>
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="projectname" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.name" value="projectname"/>
        <property name="com.jaspersoft.studio.field.label" value="projectname"/>
        <property name="com.jaspersoft.studio.field.tree.path" value="tblprojectdetails"/>
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="eplogopath" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.name" value="eplogopath"/>
        <property name="com.jaspersoft.studio.field.label" value="eplogopath"/>
        <property name="com.jaspersoft.studio.field.tree.path" value="tblprojectdetails"/>
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="clientlogopath" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.name" value="clientlogopath"/>
        <property name="com.jaspersoft.studio.field.label" value="clientlogopath"/>
        <property name="com.jaspersoft.studio.field.tree.path" value="tblprojectdetails"/>
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="dstemplatepath" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.name" value="dstemplatepath"/>
        <property name="com.jaspersoft.studio.field.label" value="dstemplatepath"/>
        <property name="com.jaspersoft.studio.field.tree.path" value="tblprojectdetails"/>
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="datasheetpath" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.name" value="datasheetpath"/>
        <property name="com.jaspersoft.studio.field.label" value="datasheetpath"/>
        <property name="com.jaspersoft.studio.field.tree.path" value="tblprojectdetails"/>
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="dsprefix" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.name" value="dsprefix"/>
        <property name="com.jaspersoft.studio.field.label" value="dsprefix"/>
        <property name="com.jaspersoft.studio.field.tree.path" value="tblprojectdetails"/>
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="projectdirectory" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.name" value="projectdirectory"/>
        <property name="com.jaspersoft.studio.field.label" value="projectdirectory"/>
        <property name="com.jaspersoft.studio.field.tree.path" value="tblprojectdetails"/>
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="sdkproject" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.name" value="sdkproject"/>
        <property name="com.jaspersoft.studio.field.label" value="sdkproject"/>
        <property name="com.jaspersoft.studio.field.tree.path" value="tblprojectdetails"/>
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="arssproject" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.name" value="arssproject"/>
        <property name="com.jaspersoft.studio.field.label" value="arssproject"/>
        <property name="com.jaspersoft.studio.field.tree.path" value="tblprojectdetails"/>
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="indexproject" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.name" value="indexproject"/>
        <property name="com.jaspersoft.studio.field.label" value="indexproject"/>
        <property name="com.jaspersoft.studio.field.tree.path" value="tblprojectdetails"/>
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="bomproject" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.name" value="bomproject"/>
        <property name="com.jaspersoft.studio.field.label" value="bomproject"/>
        <property name="com.jaspersoft.studio.field.tree.path" value="tblprojectdetails"/>
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="cableproject" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.name" value="cableproject"/>
        <property name="com.jaspersoft.studio.field.label" value="cableproject"/>
        <property name="com.jaspersoft.studio.field.tree.path" value="tblprojectdetails"/>
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <sortField name="tag"/>
    <variable name="alarmtag" class="java.lang.String">
        <variableExpression><![CDATA[MID($F{tag},2,1).contains("S" )?REPLACE($F{tag},2,1,"A"):MID($F{tag},2,2).contains("ZS" )?REPLACE($F{tag},2,2,"ZA"):$F{tag}]]></variableExpression>
    </variable>
    <filterExpression><![CDATA[$F{iotype}.equals("DI")]]></filterExpression>
    <group name="Group1" isStartNewPage="true" isReprintHeaderOnEachPage="true">
        <groupExpression><![CDATA[$F{tag}]]></groupExpression>
        <groupHeader>
            <band height="738">
                <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                <textField isBlankWhenNull="true">
                    <reportElement x="70" y="0" width="220" height="15" uuid="5cb53e2e-a063-4024-9424-3b01efa077da">
                        <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    </reportElement>
                    <box>
                        <pen lineWidth="1.0"/>
                    </box>
                    <textElement verticalAlignment="Middle">
                        <font size="7" isBold="false"/>
                        <paragraph leftIndent="3"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$F{tag}.toUpperCase()]]></textFieldExpression>
                </textField>
                <staticText>
                    <reportElement mode="Opaque" x="0" y="0" width="70" height="15" backcolor="#F0E9E9" uuid="53cfecc9-b77a-4274-a3ff-6b2224a23ca5">
                        <property name="com.jaspersoft.studio.unit.height" value="px"/>
                        <property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
                        <property name="com.jaspersoft.studio.unit.rightIndent" value="px"/>
                    </reportElement>
                    <box>
                        <pen lineWidth="1.0"/>
                    </box>
                    <textElement textAlignment="Right" verticalAlignment="Middle">
                        <font size="7" isBold="true"/>
                        <paragraph leftIndent="0" rightIndent="3"/>
                    </textElement>
                    <text><![CDATA[Instrument Tag:]]></text>
                </staticText>
                <staticText>
                    <reportElement mode="Transparent" x="-2" y="40" width="75" height="20" backcolor="#F0E9E9" uuid="0688dc7c-fc6a-437c-af04-e8a0bcb90b98">
                        <property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
                    </reportElement>
                    <box>
                        <pen lineWidth="1.0"/>
                    </box>
                    <textElement textAlignment="Right" verticalAlignment="Middle">
                        <font size="7" isBold="true"/>
                        <paragraph leftIndent="5"/>
                    </textElement>
                    <text><![CDATA[Alarm Tag:]]></text>
                </staticText>
                <textField evaluationTime="Group" evaluationGroup="Group1">
                    <reportElement x="73" y="40" width="104" height="20" uuid="3e506bae-a1a8-4100-b7de-baeabdfcb531"/>
                    <box>
                        <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                        <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                        <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                        <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                    </box>
                    <textElement verticalAlignment="Middle">
                        <font size="7"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$V{alarmtag}]]></textFieldExpression>
                </textField>
            </band>
        </groupHeader>
    </group>
    <background>
        <band splitType="Stretch"/>
    </background>
    <pageHeader>
        <band height="20"/>
    </pageHeader>
</jasperReport>

__________________________________________________________________________________________________
ReportServer error

Error: An error occurred during report execution.
The report could not be executed: Could not execute report: Errors were encountered when compiling report expressions class file: 1. The method MID(String, int, int) is undefined for the type WTEDGEMasterDILoopTest_1622085872845_727790 value = MID(((java.lang.String)field_tag.getValue()),2,1).contains("S" )?REPLACE(((java.lang.String)field_tag.getValue()),2,1,"A"):MID(((java.lang.String)field_tag.getValue()),2,2).contains("ZS" )?REPLACE(((java.lang.String)field_tag.getValue()),2,2,"ZA"):((java.lang.String)field_tag.getValue()); //$JR_EXPR_ID=10$ <-> 2. The method REPLACE(String, int, int, String) is undefined for the type WTEDGEMasterDILoopTest_1622085872845_727790 value = MID(((java.lang.String)field_tag.getValue()),2,1).contains("S" )?REPLACE(((java.lang.String)field_tag.getValue()),2,1,"A"):MID(((java.lang.String)field_tag.getValue()),2,2).contains("ZS" )?REPLACE(((java.lang.String)field_tag.getValue()),2,2,"ZA"):((java.lang.String)field_tag.getValue()); //$JR_EXPR_ID=10$ <-----> 3. The method MID(String, int, int) is undefined for the type WTEDGEMasterDILoopTest_1622085872845_727790 value = MID(((java.lang.String)field_tag.getValue()),2,1).contains("S" )?REPLACE(((java.lang.String)field_tag.getValue()),2,1,"A"):MID(((java.lang.String)field_tag.getValue()),2,2).contains("ZS" )?REPLACE(((java.lang.String)field_tag.getValue()),2,2,"ZA"):((java.lang.String)field_tag.getValue()); //$JR_EXPR_ID=10$ <-> 4. The method REPLACE(String, int, int, String) is undefined for the type WTEDGEMasterDILoopTest_1622085872845_727790 value = MID(((java.lang.String)field_tag.getValue()),2,1).contains("S" )?......

Last edited by twolsey (2021-05-27 03:26:04)

Offline

#4 2021-05-27 09:53:16

eduardo
Administrator
Registered: 2016-11-01
Website

Re: JasperReport error when using String functions Like Mid, Replace

Hi Tony,

this is not a minimal report reproducing the problem:

1. we cannot execute this sql:
Select Distinct
tblindex.*, tblprojectdetails.*
from tblindex, tblprojectdetails
Where tblprojectdetails.projectnumber = $P{ProjectNumber}
And tblindex.project = $P{ProjectNumber}

pls change it to a dummy sql or a sql on the internal reportserver database / demo data.
Also, you can delete the $P{ProjectNumber} as this should not be required in a minimal example.

2. I see a lot of fields: pls delete all unnecessary fields.

The idea would be to have a *minimal* report that allows us to reproduce the problem.

Regards,
Eduardo

Offline

#5 2021-05-27 21:14:35

twolsey
Member
Registered: 2019-01-13

Re: JasperReport error when using String functions Like Mid, Replace

Hi Eduardo

My apologies. Hopefully this is more suitable. Below is the JasperReport xml and a few tags of data for the sql.

thanks
Tony

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.16.0.final using JasperReports Library version 6.16.0-48579d909b7943b64690c65c71e07e0b80981928  -->
<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="WTEDGEMasterDILoopTest" pageWidth="612" pageHeight="792" columnWidth="572" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="10" uuid="42d79c5e-37db-4d18-9312-3b40257077b6">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="LinuxWTEDGETestDA_HST"/>
    <property name="com.jaspersoft.studio.data.sql.tables" value=""/>
    <property name="com.jaspersoft.studio.unit." value="pixel"/>
    <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
    <property name="com.jaspersoft.studio.report.description" value=""/>
    <property name="com.jaspersoft.studio.property.dataset.dialog.DatasetDialog.sash.w1" value="437"/>
    <property name="com.jaspersoft.studio.property.dataset.dialog.DatasetDialog.sash.w2" value="553"/>
    <queryString>
        <![CDATA[Select Distinct
i.tag, i.iotype
from tblindex i
]]>
    </queryString>
    <field name="tag" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.name" value="tag"/>
        <property name="com.jaspersoft.studio.field.label" value="tag"/>
        <property name="com.jaspersoft.studio.field.tree.path" value="tblindex"/>
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="iotype" class="java.lang.String">
        <property name="com.jaspersoft.studio.field.name" value="iotype"/>
        <property name="com.jaspersoft.studio.field.label" value="iotype"/>
        <property name="com.jaspersoft.studio.field.tree.path" value="tblindex"/>
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <sortField name="tag"/>
    <variable name="alarmtag" class="java.lang.String">
        <variableExpression><![CDATA[MID($F{tag},2,1).contains("S" )?REPLACE($F{tag},2,1,"A"):MID($F{tag},2,2).contains("ZS" )?REPLACE($F{tag},2,2,"ZA"):$F{tag}]]></variableExpression>
    </variable>
    <filterExpression><![CDATA[$F{iotype}.equals("DI")]]></filterExpression>
    <group name="Group1" isStartNewPage="true" isReprintHeaderOnEachPage="true">
        <groupExpression><![CDATA[$F{tag}]]></groupExpression>
        <groupHeader>
            <band height="738">
                <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                <textField isBlankWhenNull="true">
                    <reportElement x="70" y="0" width="220" height="15" uuid="5cb53e2e-a063-4024-9424-3b01efa077da">
                        <property name="com.jaspersoft.studio.unit.height" value="px"/>
                    </reportElement>
                    <box>
                        <pen lineWidth="1.0"/>
                    </box>
                    <textElement verticalAlignment="Middle">
                        <font size="7" isBold="false"/>
                        <paragraph leftIndent="3"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$F{tag}.toUpperCase()]]></textFieldExpression>
                </textField>
                <staticText>
                    <reportElement mode="Opaque" x="0" y="0" width="70" height="15" backcolor="#F0E9E9" uuid="53cfecc9-b77a-4274-a3ff-6b2224a23ca5">
                        <property name="com.jaspersoft.studio.unit.height" value="px"/>
                        <property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
                        <property name="com.jaspersoft.studio.unit.rightIndent" value="px"/>
                    </reportElement>
                    <box>
                        <pen lineWidth="1.0"/>
                    </box>
                    <textElement textAlignment="Right" verticalAlignment="Middle">
                        <font size="7" isBold="true"/>
                        <paragraph leftIndent="0" rightIndent="3"/>
                    </textElement>
                    <text><![CDATA[Instrument Tag:]]></text>
                </staticText>
                <staticText>
                    <reportElement mode="Transparent" x="-2" y="40" width="75" height="20" backcolor="#F0E9E9" uuid="0688dc7c-fc6a-437c-af04-e8a0bcb90b98">
                        <property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
                    </reportElement>
                    <box>
                        <pen lineWidth="1.0"/>
                    </box>
                    <textElement textAlignment="Right" verticalAlignment="Middle">
                        <font size="7" isBold="true"/>
                        <paragraph leftIndent="5"/>
                    </textElement>
                    <text><![CDATA[Alarm Tag:]]></text>
                </staticText>
                <textField evaluationTime="Group" evaluationGroup="Group1">
                    <reportElement x="73" y="40" width="104" height="20" uuid="3e506bae-a1a8-4100-b7de-baeabdfcb531"/>
                    <box>
                        <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                        <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                        <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                        <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
                    </box>
                    <textElement verticalAlignment="Middle">
                        <font size="7"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$V{alarmtag}]]></textFieldExpression>
                </textField>
            </band>
        </groupHeader>
    </group>
    <background>
        <band splitType="Stretch"/>
    </background>
    <pageHeader>
        <band height="20"/>
    </pageHeader>
</jasperReport>



Tag           iotype

FSH-7250    DI
FSH-7251    DI
FSH-7276    DI
FSH-7275    DI
FSH-7300    DI
FSH-7301    DI
FSH-7302    DI

Offline

#6 2021-05-29 06:24:48

twolsey
Member
Registered: 2019-01-13

Re: JasperReport error when using String functions Like Mid, Replace

Hi Eduardo

Just curious if I need additional jasperreports*.jar files from the JasperReports Library to be added into the following directory (...reportserver/WEB-INF/lib)?  I seem to only have jasperreports-6.16.0.jar and jasperreports-fonts-6.16.0.jar but seem to be missing many other JasperReport Library *.jars.
Not sure it matters but my ReportServer is running on a Linux server.

If I remove the calculated variable field ("alarmtag") that has the following calculation shown below, the report generates successfully.

MID($F{tag},2,1).contains("S" )?REPLACE($F{tag},2,1,"A"):MID($F{tag},2,2).contains("ZS" )?REPLACE($F{tag},2,2,"ZA"):$F{tag}

thanks
Tony

Last edited by twolsey (2021-05-29 06:59:01)

Offline

#7 2021-05-30 20:20:33

twolsey
Member
Registered: 2019-01-13

Re: JasperReport error when using String functions Like Mid, Replace

Hi Eduardo
I think I solved it. I had to load the following jar files into "....reportserver/WEB-INF/lib..." to make my report display without error.

jasperreports-functions-6.16.0.jar
joda-time-2.10.10.jar

thanks
Tony

Offline

#8 2021-05-31 08:09:24

eduardo
Administrator
Registered: 2016-11-01
Website

Re: JasperReport error when using String functions Like Mid, Replace

Hi Tony,

thanks for confirming this works. This was what I was going to suggest, to add these libraries, as I read on the internet this may be caused by missing jasper libraries: https://stackoverflow.com/questions/282 … ined-error

We will add these libraries to ReportServer in ticket RS-4979.

Regards,
Eduardo

Offline

#9 2021-06-01 09:18:18

eduardo
Administrator
Registered: 2016-11-01
Website

Re: JasperReport error when using String functions Like Mid, Replace

Hi Tony,

we added these libraries to ReportServer: this will be available in 3.7.0.

Regards,
Eduardo

Offline

#10 2021-06-01 17:18:16

twolsey
Member
Registered: 2019-01-13

Re: JasperReport error when using String functions Like Mid, Replace

Thanks Eduardo!

best regards
Tony

Offline

#11 2021-06-11 09:04:58

eduardo
Administrator
Registered: 2016-11-01
Website

Re: JasperReport error when using String functions Like Mid, Replace

Hi Tony,

pls note that we released 3.7.0 where this is available.

Regards,
Eduardo

Offline

#12 2021-06-11 12:15:46

twolsey
Member
Registered: 2019-01-13

Re: JasperReport error when using String functions Like Mid, Replace

Hi Eduardo
Thank you for letting me know. Much appreciated.

best regards
Tony

Offline

Board footer

Powered by FluxBB