按textElement时如何更改参数值?

时间:2016-02-19 20:56:24

标签: jasper-reports

是否可以制作Jasper软件,以便在按下参数的文本元素值时更改?

代码:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0  -->
<!-- 2016-02-19T23:46:44 -->
<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="Main Menu" pageWidth="500" pageHeight="85" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="500" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="e7435a7b-5c14-49c7-8fe8-822df3de3810">
    <property name="com.jaspersoft.studio.unit." value="pixel"/>
    <property name="ireport.jasperserver.url" value="http://stats.trackif.com/jasperserver-pro/services/repository/"/>
    <property name="ireport.jasperserver.user" value="jasperadmin"/>
    <property name="ireport.jasperserver.report.resource" value="/csi/New_Version/Main_Menu_files/main_jrxml"/>
    <property name="ireport.jasperserver.reportUnit" value="/csi/New_Version/Main_Menu"/>
    <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"/>
    <style name="MenuItem" mode="Opaque" forecolor="#E1FFE1" backcolor="#333333" hTextAlign="Center" vTextAlign="Middle" fontName="" fontSize="13"/>
    <style name="MenuItem_Dashboard" style="MenuItem">
        <conditionalStyle>
            <conditionExpression><![CDATA[$P{SelectedMenuItem} == 0]]></conditionExpression>
            <style backcolor="#24AD80"/>
        </conditionalStyle>
    </style>
    <style name="MenuItem_Members" style="MenuItem">
        <conditionalStyle>
            <conditionExpression><![CDATA[$P{SelectedMenuItem} == 1]]></conditionExpression>
            <style backcolor="#24AD80"/>
        </conditionalStyle>
    </style>
    <style name="MenuItem_Trackers" style="MenuItem">
        <conditionalStyle>
            <conditionExpression><![CDATA[$P{SelectedMenuItem} == 2]]></conditionExpression>
            <style backcolor="#24AD80"/>
        </conditionalStyle>
    </style>
    <style name="IconBackground"/>
    <style name="IconBackground_Members_Table" style="IconBackground" pattern="">
        <conditionalStyle>
            <conditionExpression><![CDATA[AND($P{SelectedMenuItem} == 1, $P{SelectedIcon} == 0)]]></conditionExpression>
            <style mode="Opaque" backcolor="#24AD80"/>
        </conditionalStyle>
    </style>
    <style name="IconBackground_Members_Chart" style="IconBackground">
        <conditionalStyle>
            <conditionExpression><![CDATA[AND($P{SelectedMenuItem} == 1, $P{SelectedIcon} == 1)]]></conditionExpression>
            <style mode="Opaque" backcolor="#24AD80"/>
        </conditionalStyle>
    </style>
    <style name="IconBackground_Trackers_Table" style="IconBackground" pattern="">
        <conditionalStyle>
            <conditionExpression><![CDATA[AND($P{SelectedMenuItem} == 2, $P{SelectedIcon} == 0)]]></conditionExpression>
            <style mode="Opaque" backcolor="#24AD80"/>
        </conditionalStyle>
    </style>
    <style name="IconBackground_Trackers_Chart" style="IconBackground">
        <conditionalStyle>
            <conditionExpression><![CDATA[AND($P{SelectedMenuItem} == 2, $P{SelectedIcon} == 1)]]></conditionExpression>
            <style mode="Opaque" backcolor="#24AD80"/>
        </conditionalStyle>
    </style>
    <style name="MenuItem_Alerts" style="MenuItem">
        <conditionalStyle>
            <conditionExpression><![CDATA[$P{SelectedMenuItem} == 3]]></conditionExpression>
            <style backcolor="#24AD80"/>
        </conditionalStyle>
    </style>
    <style name="IconBackground_Alerts_Table" style="IconBackground" pattern="">
        <conditionalStyle>
            <conditionExpression><![CDATA[AND($P{SelectedMenuItem} == 3, $P{SelectedIcon} == 0)]]></conditionExpression>
            <style mode="Opaque" backcolor="#24AD80"/>
        </conditionalStyle>
    </style>
    <style name="IconBackground_Alerts_Chart" style="IconBackground">
        <conditionalStyle>
            <conditionExpression><![CDATA[AND($P{SelectedMenuItem} == 3, $P{SelectedIcon} == 1)]]></conditionExpression>
            <style mode="Opaque" backcolor="#24AD80"/>
        </conditionalStyle>
    </style>
    <parameter name="SelectedMenuItem" class="java.lang.Integer">
        <parameterDescription><![CDATA[]]></parameterDescription>
        <defaultValueExpression><![CDATA[0]]></defaultValueExpression>
    </parameter>
    <parameter name="SelectedIcon" class="java.lang.Integer">
        <defaultValueExpression><![CDATA[0]]></defaultValueExpression>
    </parameter>
    <parameter name="ClientId" class="java.lang.Integer">
        <defaultValueExpression><![CDATA[37]]></defaultValueExpression>
    </parameter>
    <parameter name="StartDate" class="java.util.Date">
        <parameterDescription><![CDATA[]]></parameterDescription>
        <defaultValueExpression><![CDATA[new Date(new Date(System.currentTimeMillis()-15*24*60*60*1000).getTime()-1000*60*60*24*15)]]></defaultValueExpression>
    </parameter>
    <parameter name="EndDate" class="java.util.Date">
        <defaultValueExpression><![CDATA[TODAY()]]></defaultValueExpression>
    </parameter>
    <queryString>
        <![CDATA[]]>
    </queryString>
    <variable name="Count_Number" class="java.lang.Integer" calculation="Count">
        <variableExpression><![CDATA[Boolean.TRUE]]></variableExpression>
    </variable>
    <title>
        <band height="85" splitType="Stretch">
            <textField evaluationTime="Report" isBlankWhenNull="true">
                <reportElement style="IconBackground_Trackers_Chart" x="245" y="40" width="45" height="45" uuid="ddb8960a-425e-4ddf-8ab8-8bdce87b316c">
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                </reportElement>
            </textField>
            <textField evaluationTime="Report" isBlankWhenNull="true">
                <reportElement style="IconBackground_Trackers_Table" x="200" y="40" width="45" height="45" uuid="b32db645-a654-44c6-a77b-03d296eacd69">
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
            </textField>
            <textField evaluationTime="Report" isBlankWhenNull="true">
                <reportElement style="IconBackground_Members_Chart" x="145" y="40" width="45" height="45" uuid="5960e8a3-3dcc-4e99-b410-7758820f469c">
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                </reportElement>
            </textField>
            <textField evaluationTime="Report" isBlankWhenNull="true">
                <reportElement style="IconBackground_Members_Table" x="100" y="40" width="45" height="45" uuid="9f93dc32-99ba-4218-946e-f65ba0834c4a">
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
                </reportElement>
            </textField>
            <textField evaluationTime="Band" hyperlinkType="ReportExecution">
                <reportElement key="" style="MenuItem_Dashboard" x="0" y="0" width="100" height="40" uuid="17bba765-2b33-48ee-a157-4d091a553548">
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textFieldExpression><![CDATA["Dashboard"]]></textFieldExpression>
                <hyperlinkReferenceExpression><![CDATA["http://stats.trackif.com/jasperserver-pro/dashboard/viewer.html#%2Fcsi%2Fdashboards%2FMain_Page_Totals&ClientId=" + $P{ClientId}]]></hyperlinkReferenceExpression>
                <hyperlinkParameter name="_report">
                    <hyperlinkParameterExpression><![CDATA["/csi/New_Version/main_page_totals"]]></hyperlinkParameterExpression>
                </hyperlinkParameter>
                <hyperlinkParameter name="ClientId">
                    <hyperlinkParameterExpression><![CDATA[$P{ClientId}]]></hyperlinkParameterExpression>
                </hyperlinkParameter>
            </textField>
            <textField evaluationTime="Band" hyperlinkType="ReportExecution">
                <reportElement style="MenuItem_Members" x="100" y="0" width="100" height="40" uuid="5cfc95a0-730c-423a-885e-a5c8f3e92f18">
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textFieldExpression><![CDATA["Members"]]></textFieldExpression>
                <hyperlinkReferenceExpression><![CDATA["http://stats.trackif.com/jasperserver-pro/dashboard/viewer.html#%2Fcsi%2Fdashboards%2FMembers_Table&ClientId=" + $P{ClientId} + "&SelectedMenuItem=1"]]></hyperlinkReferenceExpression>
            </textField>
            <textField evaluationTime="Band" hyperlinkType="Reference" hyperlinkTarget="Parent">
                <reportElement style="MenuItem_Trackers" x="200" y="0" width="100" height="40" uuid="4e6a3fb2-6a9a-4468-a457-b1d484e13e35">
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textFieldExpression><![CDATA["Trackers"]]></textFieldExpression>
                <hyperlinkReferenceExpression><![CDATA["http://stats.trackif.com/jasperserver-pro/dashboard/viewer.html#%2Fcsi%2Fdashboards%2FTrackers_Table&ClientId=" + $P{ClientId} + "&SelectedMenuItem=2"]]></hyperlinkReferenceExpression>
            </textField>
            <image evaluationTime="Band" hyperlinkType="Reference" hyperlinkTarget="Parent">
                <reportElement x="106" y="46" width="32" height="32" uuid="3440245e-27de-46c8-b516-c43b24953313">
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    <printWhenExpression><![CDATA[$P{SelectedMenuItem} == 1]]></printWhenExpression>
                </reportElement>
                <imageExpression><![CDATA["repo:table.png"]]></imageExpression>
                <hyperlinkReferenceExpression><![CDATA["http://stats.trackif.com/jasperserver-pro/dashboard/viewer.html#%2Fcsi%2Fdashboards%2FMembers_Table&ClientId=" + $P{ClientId} + "&SelectedMenuItem=1"]]></hyperlinkReferenceExpression>
            </image>
            <image evaluationTime="Band" hyperlinkType="Reference" hyperlinkTarget="Parent">
                <reportElement x="151" y="46" width="32" height="32" uuid="b67f389c-0e19-43f3-9b86-aa884ee4a3bc">
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    <printWhenExpression><![CDATA[$P{SelectedMenuItem} == 1]]></printWhenExpression>
                </reportElement>
                <imageExpression><![CDATA["repo:chart.png"]]></imageExpression>
                <hyperlinkReferenceExpression><![CDATA["http://stats.trackif.com/jasperserver-pro/dashboard/viewer.html#%2Fcsi%2Fdashboards%2FMembers_Chart_By_Day&ClientId=" + $P{ClientId} + "&SelectedMenuItem=1&SelectedIcon=1"]]></hyperlinkReferenceExpression>
                <hyperlinkTooltipExpression><![CDATA["Daily"]]></hyperlinkTooltipExpression>
            </image>
            <image evaluationTime="Band" hyperlinkType="Reference" hyperlinkTarget="Parent">
                <reportElement x="206" y="46" width="32" height="32" uuid="55c06527-6e84-40fc-9691-2676bfb11b67">
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    <printWhenExpression><![CDATA[$P{SelectedMenuItem} == 2]]></printWhenExpression>
                </reportElement>
                <imageExpression><![CDATA["repo:table1.png"]]></imageExpression>
                <hyperlinkReferenceExpression><![CDATA["http://stats.trackif.com/jasperserver-pro/dashboard/viewer.html#%2Fcsi%2Fdashboards%2FTrackers_Table&ClientId=" + $P{ClientId} + "&SelectedMenuItem=2"]]></hyperlinkReferenceExpression>
            </image>
            <image evaluationTime="Band" hyperlinkType="Reference" hyperlinkTarget="Parent">
                <reportElement x="251" y="46" width="32" height="32" uuid="398f6b96-fd30-4fc9-99c8-79aaba500838">
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    <printWhenExpression><![CDATA[$P{SelectedMenuItem} == 2]]></printWhenExpression>
                </reportElement>
                <imageExpression><![CDATA["repo:chart1.png"]]></imageExpression>
                <hyperlinkReferenceExpression><![CDATA["http://stats.trackif.com/jasperserver-pro/dashboard/viewer.html#%2Fcsi%2Fdashboards%2FTrackers_Chart_By_Day&ClientId=" + $P{ClientId} + "&SelectedMenuItem=2&SelectedIcon=1"]]></hyperlinkReferenceExpression>
            </image>
            <textField evaluationTime="Band" hyperlinkType="Reference" hyperlinkTarget="Parent">
                <reportElement style="MenuItem_Alerts" x="300" y="0" width="100" height="40" uuid="c5e36e04-be9f-4051-a9a9-b8bafd1ceb3f">
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <textFieldExpression><![CDATA["Alerts"]]></textFieldExpression>
                <hyperlinkReferenceExpression><![CDATA["http://stats.trackif.com/jasperserver-pro/dashboard/viewer.html#%2Fcsi%2Fdashboards%2FAlerts_Table&ClientId=" + $P{ClientId} + "&SelectedMenuItem=3"]]></hyperlinkReferenceExpression>
            </textField>
            <image evaluationTime="Band" hyperlinkType="Reference" hyperlinkTarget="Parent">
                <reportElement key="" style="IconBackground_Alerts_Table" x="306" y="46" width="32" height="32" uuid="613ae391-ef0a-487f-a79f-c3cbe92068b7">
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    <printWhenExpression><![CDATA[$P{SelectedMenuItem} == 3]]></printWhenExpression>
                </reportElement>
                <imageExpression><![CDATA["repo:table1.png"]]></imageExpression>
                <hyperlinkReferenceExpression><![CDATA["http://stats.trackif.com/jasperserver-pro/dashboard/viewer.html#%2Fcsi%2Fdashboards%2FAlerts_Table&ClientId=" + $P{ClientId} + "&SelectedMenuItem=3"]]></hyperlinkReferenceExpression>
            </image>
            <textField evaluationTime="Report" isBlankWhenNull="true">
                <reportElement style="IconBackground_Alerts_Chart" x="345" y="40" width="45" height="45" uuid="e470ee22-217e-4362-ad5f-8ab5ef781b99">
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                </reportElement>
            </textField>
            <image evaluationTime="Band" hyperlinkType="Reference" hyperlinkTarget="Parent">
                <reportElement x="351" y="46" width="32" height="32" uuid="5bbf9696-54ba-44dc-b025-dc7a52a1521c">
                    <property name="com.jaspersoft.studio.unit.width" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                    <printWhenExpression><![CDATA[$P{SelectedMenuItem} == 3]]></printWhenExpression>
                </reportElement>
                <imageExpression><![CDATA["repo:chart1.png"]]></imageExpression>
                <hyperlinkReferenceExpression><![CDATA["http://stats.trackif.com/jasperserver-pro/dashboard/viewer.html#%2Fcsi%2Fdashboards%2FAlerts_Chart_By_Day&ClientId=" + $P{ClientId} + "&SelectedMenuItem=3&SelectedIcon=1"]]></hyperlinkReferenceExpression>
            </image>
        </band>
    </title>
</jasperReport>

在这个例子中我希望在按下&#34;会员&#34; SelectedMenuItem参数将在值&#39; 1&#39;上更改。默认值此参数= 0。 是否有可能做到这一点?

0 个答案:

没有答案