Jump to content
We've recently updated our Privacy Statement, available here ×
  • Revisit Tip : Multi Select Parameter Example in Jaspersoft Design Studio Reports | How to give default values for multi select paraemter in Jasper Reports


    Revisit : Multi Select Parameter Example in Jasper Reports 

    Default value expression: 
    java.util.Arrays.asList(new String[]{"99993","99962","99949"})  

    References: 

    Parameter Properties : 
    param.png
    Server output: 
    multiselectparams.png

    JRXML 
    <?xml version="1.0" encoding="UTF-8"?>

    <!-- Created with Jaspersoft Studio version 6.4.21.final using JasperReports Library version 6.4.1 -->

    <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="MultiSelectParameterDefaultValue" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="0a843e05-bf78-488a-bb0d-44f948a799f6">

    <property name="com.jaspersoft.studio.data.sql.tables" value=""/>

    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="foodmart"/>

    <property name="ireport.jasperserver.url" value="http://localhost:8080/jasperserver-pro/"/>

    <property name="ireport.jasperserver.user" value="superuser"/>

    <property name="ireport.jasperserver.report.resource" value="/EarthlySystems/Multi_Select_Parameter_Demo/Multi_Select_Parameter_Default_Value_files/main_jrxml"/>

    <property name="ireport.jasperserver.reportUnit" value="/EarthlySystems/Multi_Select_Parameter_Demo/Multi_Select_Parameter_Default_Value"/>

    <parameter name="paramPostalCode" class="java.util.Collection" nestedType="java.lang.String">

    <defaultValueExpression><![CDATA[java.util.Arrays.asList(new String[]{"99993","99962","99949"})

     

    ]]></defaultValueExpression>

    </parameter>

    <queryString language="SQL">

    <![CDATA[select * from customer where $X{IN, postal_code, paramPostalCode}]]>

    </queryString>

    <field name="customer_id" class="java.lang.Integer"/>

    <field name="account_num" class="java.lang.Long"/>

    <field name="lname" class="java.lang.String"/>

    <field name="fname" class="java.lang.String"/>

    <field name="mi" class="java.lang.String"/>

    <field name="address1" class="java.lang.String"/>

    <field name="address2" class="java.lang.String"/>

    <field name="address3" class="java.lang.String"/>

    <field name="address4" class="java.lang.String"/>

    <field name="city" class="java.lang.String"/>

    <field name="state_province" class="java.lang.String"/>

    <field name="postal_code" class="java.lang.String"/>

    <field name="country" class="java.lang.String"/>

    <field name="customer_region_id" class="java.lang.Integer"/>

    <field name="phone1" class="java.lang.String"/>

    <field name="phone2" class="java.lang.String"/>

    <field name="birthdate" class="java.sql.Date"/>

    <field name="marital_status" class="java.lang.String"/>

    <field name="yearly_income" class="java.lang.String"/>

    <field name="gender" class="java.lang.String"/>

    <field name="total_children" class="java.lang.Integer"/>

    <field name="num_children_at_home" class="java.lang.Integer"/>

    <field name="education" class="java.lang.String"/>

    <field name="date_accnt_opened" class="java.sql.Date"/>

    <field name="member_card" class="java.lang.String"/>

    <field name="occupation" class="java.lang.String"/>

    <field name="houseowner" class="java.lang.String"/>

    <field name="num_cars_owned" class="java.lang.Integer"/>

    <field name="fullname" class="java.lang.String"/>

    <background>

    <band splitType="Stretch"/>

    </background>

    <title>

    <band height="36" splitType="Stretch">

    <textField>

    <reportElement mode="Opaque" x="0" y="0" width="555" height="36" backcolor="#ECE0FF" uuid="f4bc67c0-499c-48cd-af15-6703eb08f358">

    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>

    </reportElement>

    <box>

    <pen lineColor="#D6D0D0"/>

    <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    </box>

    <textElement textAlignment="Center" verticalAlignment="Middle">

    <font size="12" isBold="true"/>

    </textElement>

    <textFieldExpression><![CDATA["Customer Detail Report By Postal Code"]]></textFieldExpression>

    </textField>

    </band>

    </title>

    <columnHeader>

    <band height="30" splitType="Stretch">

    <staticText>

    <reportElement x="0" y="0" width="81" height="30" uuid="950cfd64-6561-445f-aa06-df9d92402d33"/>

    <box>

    <pen lineColor="#D6D0D0"/>

    <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    </box>

    <textElement textAlignment="Center" verticalAlignment="Middle"/>

    <text><![CDATA[customer_id]]></text>

    </staticText>

    <staticText>

    <reportElement x="81" y="0" width="79" height="30" uuid="60014d13-d4e3-49e1-85f7-cec9b3860db2"/>

    <box>

    <pen lineColor="#D6D0D0"/>

    <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    </box>

    <textElement textAlignment="Center" verticalAlignment="Middle"/>

    <text><![CDATA[account_num]]></text>

    </staticText>

    <staticText>

    <reportElement x="160" y="0" width="79" height="30" uuid="8298d207-c566-4c62-96af-7c5ec3438111"/>

    <box>

    <pen lineColor="#D6D0D0"/>

    <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    </box>

    <textElement textAlignment="Center" verticalAlignment="Middle"/>

    <text><![CDATA[lname]]></text>

    </staticText>

    <staticText>

    <reportElement x="239" y="0" width="79" height="30" uuid="1f425d7f-2817-4cda-b688-42c48dc72ee5"/>

    <box>

    <pen lineColor="#D6D0D0"/>

    <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    </box>

    <textElement textAlignment="Center" verticalAlignment="Middle"/>

    <text><![CDATA[city]]></text>

    </staticText>

    <staticText>

    <reportElement x="318" y="0" width="79" height="30" uuid="cc44460f-c5ea-4c7f-b24c-9f1313ffaa13"/>

    <box>

    <pen lineColor="#D6D0D0"/>

    <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    </box>

    <textElement textAlignment="Center" verticalAlignment="Middle"/>

    <text><![CDATA[state_province]]></text>

    </staticText>

    <staticText>

    <reportElement x="397" y="0" width="79" height="30" uuid="2f6d5fe4-8130-40c5-8f65-e3845b818625"/>

    <box>

    <pen lineColor="#D6D0D0"/>

    <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    </box>

    <textElement textAlignment="Center" verticalAlignment="Middle"/>

    <text><![CDATA[postal_code]]></text>

    </staticText>

    <staticText>

    <reportElement x="476" y="0" width="79" height="30" uuid="3381d500-9086-431c-9678-cef469425d11"/>

    <box>

    <pen lineColor="#D6D0D0"/>

    <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    </box>

    <textElement textAlignment="Center" verticalAlignment="Middle"/>

    <text><![CDATA[country]]></text>

    </staticText>

    </band>

    </columnHeader>

    <detail>

    <band height="30" splitType="Stretch">

    <textField>

    <reportElement x="0" y="0" width="81" height="30" uuid="d9d71552-8c5d-4f5f-adc5-f688e7d1b26e">

    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>

    </reportElement>

    <box>

    <pen lineColor="#D6D0D0"/>

    <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    </box>

    <textElement textAlignment="Center" verticalAlignment="Middle"/>

    <textFieldExpression><![CDATA[$F{customer_id}]]></textFieldExpression>

    </textField>

    <textField>

    <reportElement x="81" y="0" width="79" height="30" uuid="5bc3525d-9b53-479e-bc3f-b6f78898c4a0"/>

    <box>

    <pen lineColor="#D6D0D0"/>

    <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    </box>

    <textElement textAlignment="Center" verticalAlignment="Middle"/>

    <textFieldExpression><![CDATA[$F{account_num}]]></textFieldExpression>

    </textField>

    <textField>

    <reportElement x="160" y="0" width="79" height="30" uuid="8f4c3632-b891-470f-8c6b-e7ad7d7b45d5"/>

    <box>

    <pen lineColor="#D6D0D0"/>

    <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    </box>

    <textElement textAlignment="Center" verticalAlignment="Middle"/>

    <textFieldExpression><![CDATA[$F{lname}]]></textFieldExpression>

    </textField>

    <textField>

    <reportElement x="239" y="0" width="79" height="30" uuid="e288ef3a-54ad-4832-99c6-d5cdcea3c8cb"/>

    <box>

    <pen lineColor="#D6D0D0"/>

    <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    </box>

    <textElement textAlignment="Center" verticalAlignment="Middle"/>

    <textFieldExpression><![CDATA[$F{city}]]></textFieldExpression>

    </textField>

    <textField>

    <reportElement x="318" y="0" width="79" height="30" uuid="ec922197-b510-4504-ac83-39bb76c4c252"/>

    <box>

    <pen lineColor="#D6D0D0"/>

    <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    </box>

    <textElement textAlignment="Center" verticalAlignment="Middle"/>

    <textFieldExpression><![CDATA[$F{state_province}]]></textFieldExpression>

    </textField>

    <textField>

    <reportElement x="397" y="0" width="79" height="30" uuid="6ed97799-b8d8-4398-9714-475844cc536f"/>

    <box>

    <pen lineColor="#D6D0D0"/>

    <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    </box>

    <textElement textAlignment="Center" verticalAlignment="Middle"/>

    <textFieldExpression><![CDATA[$F{postal_code}]]></textFieldExpression>

    </textField>

    <textField>

    <reportElement x="476" y="0" width="79" height="30" uuid="4f6b9312-5caf-4b7a-8596-5a6891ce97f1"/>

    <box>

    <pen lineColor="#D6D0D0"/>

    <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#D6D0D0"/>

    </box>

    <textElement textAlignment="Center" verticalAlignment="Middle"/>

    <textFieldExpression><![CDATA[$F{country}]]></textFieldExpression>

    </textField>

    </band>

    </detail>

    </jasperReport>


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...