How to use two strings in wildsearch

0

How to use two strings in wildsearch in Jasper report. For example, I want to search all projects where "Project" string appears and "6" appears in Project name filter (say)

uruj.pruthi's picture
Joined: Jun 16 2017 - 2:53am
Last seen: 3 weeks 2 days ago

2 Answers:

0

$F{PROJECT}.contains( "Project" ) && $F{PROJECT_NAME}.contains("6") == true

This would be your filter expression.

 

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0  -->
<!-- 2017-06-16T08:50:38 -->
<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="stringsearch" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="e5118725-35ac-481b-946a-e789d71ccba1">
    <property name="com.jaspersoft.studio.data.sql.tables" value=""/>
    <queryString>
        <![CDATA[select 'Project1' as project, 'tango6'  as project_name from dual union all
select 'Project2' as project, 'tango1' as project_name from dual]]>
    </queryString>
    <field name="PROJECT" class="java.lang.String"/>
    <field name="PROJECT_NAME" class="java.lang.String"/>
    <filterExpression><![CDATA[$F{PROJECT}.contains( "Project" ) && $F{PROJECT_NAME}.contains("6") == true]]></filterExpression>
    <background>
        <band splitType="Stretch"/>
    </background>
    <columnHeader>
        <band height="20" splitType="Stretch">
            <staticText>
                <reportElement x="0" y="0" width="80" height="20" uuid="75dad88e-bc31-4c3e-b683-93a946461cdd"/>
                <text><![CDATA[PROJECT]]></text>
            </staticText>
            <staticText>
                <reportElement x="80" y="0" width="100" height="20" uuid="99b3ffd4-8933-4cae-8a38-4783d2a987e4"/>
                <text><![CDATA[PROJECT_NAME]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="20" splitType="Stretch">
            <textField>
                <reportElement x="0" y="0" width="80" height="20" uuid="aa79fb4e-a0ca-4b9a-9571-c4c3f62c2c35"/>
                <textFieldExpression><![CDATA[$F{PROJECT}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="80" y="0" width="100" height="20" uuid="00ede68c-888c-4c4d-9e8a-904bda313d20"/>
                <textFieldExpression><![CDATA[$F{PROJECT_NAME}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
</jasperReport>
 

reportdev's picture
686
Joined: Oct 12 2015 - 12:05pm
Last seen: 2 days 21 hours ago
0

Thank you. But I wanted to wildsearch for end users on application side.

 

For example, In CA PPM we can serach like Project Name  by *PRJ*89

But in Jasper filter, we need to write exact like PRJ-1089 to search.

uruj.pruthi's picture
Joined: Jun 16 2017 - 2:53am
Last seen: 3 weeks 2 days ago
Feedback
randomness