Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7963031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:30:50+00:00 2026-06-04T05:30:50+00:00

How to migrate if-else expression from JasperReports 4.x syntax to JasperReports 2.x syntax? This

  • 0

How to migrate if-else expression from JasperReports 4.x syntax to JasperReports 2.x syntax?

This is my code:

<?xml version="1.0" encoding="UTF-8"  ?>
<!-- Created with iReport - A designer for JasperReports -->
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport
         name="convertString"
         columnCount="1"
         printOrder="Vertical"
         orientation="Portrait"
         pageWidth="595"
         pageHeight="842"
         columnWidth="555"
         columnSpacing="0"
         leftMargin="20"
         rightMargin="20"
         topMargin="20"
         bottomMargin="20"
         whenNoDataType="NoPages"
         isTitleNewPage="false"
         isSummaryNewPage="false">
    <property name="ireport.zoom" value="1.0" />
    <property name="ireport.x" value="0" />
    <property name="ireport.y" value="6" />
    <property name="ireport.scriptlethandling" value="0" />
    <property name="ireport.encoding" value="UTF-8" />
    <import value="java.util.*" />
    <import value="net.sf.jasperreports.engine.*" />
    <import value="net.sf.jasperreports.engine.data.*" />
    <import value="com.google.common.base.*" />

    <parameter name="pd_id" isForPrompting="true" class="java.lang.Integer"/>
    <parameter name="acl" isForPrompting="true" class="java.lang.String"/>
    <queryString><![CDATA[select * from WF_PROC_DEF,acl_module
where pd_id=$P{pd_id}
and acl_module_id = $P{acl}]]></queryString>

    <field name="PD_ID" class="java.math.BigDecimal"/>
    <field name="PD_NAME" class="java.lang.String"/>
    <field name="OLD_PD_ID" class="java.lang.String"/>
    <field name="ACL_MODULE_ID" class="java.lang.String"/>
    <field name="ACL_MODULE_DESC" class="java.lang.String"/>

        <background>
            <band height="0"  isSplitAllowed="true" >
            </band>
        </background>
        <title>
            <band height="79"  isSplitAllowed="true" >
                <textField isStretchWithOverflow="true" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
                    <reportElement
                        x="17"
                        y="18"
                        width="100"
                        height="20"
                        key="textField"
                        isRemoveLineWhenBlank="true"/>
                    <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
                    <textElement>
                        <font/>
                    </textElement>
                <textFieldExpression   class="java.lang.String"><![CDATA[$P{pd_id}==1 ? "External Agencies" :
$P{pd_id}==2 ? "Planning, Building & Land" :
$P{pd_id}==3 ? "Composit Forms" :$P{pd_id}]]></textFieldExpression>
                </textField>
            </band>
        </title>
        <pageHeader>
            <band height="0"  isSplitAllowed="true" >
            </band>
        </pageHeader>
        <columnHeader>
            <band height="20"  isSplitAllowed="true" >
                <staticText>
                    <reportElement
                        x="0"
                        y="0"
                        width="277"
                        height="20"
                        key="staticText"/>
                    <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
                    <textElement>
                        <font/>
                    </textElement>
                <text><![CDATA[PD_ID]]></text>
                </staticText>
                <staticText>
                    <reportElement
                        x="277"
                        y="0"
                        width="277"
                        height="20"
                        key="staticText"/>
                    <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
                    <textElement>
                        <font/>
                    </textElement>
                <text><![CDATA[PD_NAME]]></text>
                </staticText>
            </band>
        </columnHeader>
        <detail>
            <band height="20"  isSplitAllowed="true" >
                <textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
                    <reportElement
                        x="0"
                        y="0"
                        width="277"
                        height="20"
                        key="textField"/>
                    <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
                    <textElement>
                        <font/>
                    </textElement>
                <textFieldExpression   class="java.lang.String"><![CDATA[$F{PD_ID}]]></textFieldExpression>
                </textField>
                <textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
                    <reportElement
                        x="277"
                        y="0"
                        width="277"
                        height="20"
                        key="textField"/>
                    <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
                    <textElement>
                        <font/>
                    </textElement>
                <textFieldExpression   class="java.lang.String"><![CDATA[$F{PD_NAME}]]></textFieldExpression>
                </textField>
            </band>
        </detail>
        <columnFooter>
            <band height="45"  isSplitAllowed="true" >
            </band>
        </columnFooter>
        <pageFooter>
            <band height="54"  isSplitAllowed="true" >
            </band>
        </pageFooter>
        <summary>
            <band height="42"  isSplitAllowed="true" >
            </band>
        </summary>
</jasperReport>

Another question:

Do you have a few brief examples or tutorials on iReport 2.0.2?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T05:30:51+00:00Added an answer on June 4, 2026 at 5:30 am

    I don’t think the if else format has changed. You can use the ternary operator to accomplish your goal. Please show error output if you’re getting specific problems.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This morning, while trying to migrate some files from my test server to my
I'm a linux noob wanting to migrate this piece of C# code: using System;
We are about to migrate an intranet web application from using a proprietary forms-based
How do I migrate table schemas from one DB to another without damaging the
I would like to migrate all my unit tests from NUnit to MSTest. In
I want to migrate schema from Oracle to MySQl, so are there any free
I keep getting this exception: SQLite3::SQLException: no such column: books.user_id: SELECT books.* FROM books
I'm trying to migrate from plone 3.3.5 to plone 4.0.7 and I'm stuck on
Note: Sorry this is not exactly a programming question; please migrate it if there
As discussed in this thread , Entity Framework Code First is suited for a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.