Jump to content
Changes to the Jaspersoft community edition download ×

rick.kruyf

Members
  • Posts

    3
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Everything posted by rick.kruyf

  1. I have a report that uses a multiple value parameter (class = java.util.collection), I am trying to Filter expression in the report designer to use the $X{IN, dbfieldname, parametername} but the report will not preview and the syntax is not recognized. Is the syntax not allowed in the expression designer. <filterExpression><![CDATA[$X{IN,sales_fact_ALL.sales__store.sales__store__region.sales__store__region__sales_country,Country}]]></filterExpression> Why $X? I am trying pass the values of the parameter set to the filter expression to only return rows where the database value = a value in the array of choices for the parameter. Need the following: What class to use for the parameter (class and nested class if required)the syntax to achieve this in the filter expression using the supermarket sample domain.Source <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="parameter" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="6bb96149-77ed-4337-b19f-425d6aa143ad"> <property name="ireport.jasperserver.url" value="http://192.168.1.13:8081/jasperserver-pro/"/> <property name="ireport.domainUri" value="/public/Samples/Domains/supermartDomain"/> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="Domain JRS"/> <property name="ireport.jasperserver.report.resource" value="/Testing/Reports/parameter_files/main_jrxml"/> <property name="ireport.jasperserver.reportUnit" value="/Testing/Reports/parameter"/> <parameter name="Country" class="java.util.collection"> <parameterDescription><![CDATA[select Country]]></parameterDescription> </parameter> <parameter name="LoggedInUser" class="com.jaspersoft.jasperserver.api.metadata.user.domain.User" isForPrompting="false"/> <parameter name="LoggedInUsername" class="java.lang.String" isForPrompting="false"/> <queryString language="domain"> <![CDATA[<query> <queryFields> <queryField id="sales_fact_ALL.sales__store.sales__store__region.sales__store__region__sales_country"/> <queryField id="sales_fact_ALL.sales_fact_ALL__store_sales_2013"/> </queryFields> </query>]]> </queryString> <field name="sales_fact_ALL.sales__store.sales__store__region.sales__store__region__sales_country" class="java.lang.String"> <fieldDescription><![CDATA[Country]]></fieldDescription> </field> <field name="sales_fact_ALL.sales_fact_ALL__store_sales_2013" class="java.math.BigDecimal"> <fieldDescription><![CDATA[store Sales 2013]]></fieldDescription> </field> <sortField name="sales_fact_ALL.sales__store.sales__store__region.sales__store__region__sales_country" order="Descending"/> <variable name="TotalSales" class="java.math.BigDecimal" resetType="Group" resetGroup="Country" calculation="Sum"> <variableExpression><![CDATA[$F{sales_fact_ALL.sales_fact_ALL__store_sales_2013}]]></variableExpression> </variable> <variable name="Number of Sales" class="java.math.BigDecimal" resetType="Group" resetGroup="Country" calculation="Count"> <variableExpression><![CDATA[$F{sales_fact_ALL.sales_fact_ALL__store_sales_2013}]]></variableExpression> </variable> <filterExpression><![CDATA[$X{IN,sales_fact_ALL.sales__store.sales__store__region.sales__store__region__sales_country,Country}]]></filterExpression> <group name="Country"> <groupExpression><![CDATA[$F{sales_fact_ALL.sales__store.sales__store__region.sales__store__region__sales_country}]]></groupExpression> <groupFooter> <band height="26"> <textField> <reportElement x="0" y="0" width="180" height="20" uuid="78d8f110-a688-414a-8ed0-d52ba70d521c"/> <textFieldExpression><![CDATA[$F{sales_fact_ALL.sales__store.sales__store__region.sales__store__region__sales_country}]]></textFieldExpression> </textField> <textField pattern="¤#,###.###;¤(#,###.###-)"> <reportElement x="198" y="0" width="132" height="20" uuid="673f7386-d4ee-479d-b8e8-af142fbba740"/> <textElement textAlignment="Right" verticalAlignment="Top"/> <textFieldExpression><![CDATA[$V{TotalSales}]]></textFieldExpression> </textField> <textField> <reportElement x="360" y="0" width="100" height="20" uuid="bf0a6cd1-8349-49ed-be81-ec80020a7430"/> <textElement textAlignment="Right"/> <textFieldExpression><![CDATA[$V{Number of Sales}]]></textFieldExpression> </textField> </band> </groupFooter> </group> <background> <band splitType="Stretch"/> </background> <title> <band height="79" splitType="Stretch"/> </title> <pageHeader> <band height="49" splitType="Stretch"/> </pageHeader> <columnHeader> <band height="26" splitType="Stretch"> <staticText> <reportElement x="0" y="0" width="180" height="20" uuid="21717e60-3107-4211-a4d0-269ef3ee9353"/> <textElement> <font isBold="true"/> </textElement> <text><![CDATA[Country]]></text> </staticText> <staticText> <reportElement x="198" y="0" width="132" height="20" uuid="b90e459f-5625-42b6-9959-a092636960a9"/> <textElement textAlignment="Right"> <font isBold="true"/> </textElement> <text><![CDATA[sales]]></text> </staticText> <staticText> <reportElement x="360" y="0" width="100" height="20" uuid="66f4ba78-2d0d-46a5-89b2-4c99cca058cd"/> <textElement textAlignment="Right"> <font isBold="true"/> </textElement> <text><![CDATA[Number of Sales]]></text> </staticText> </band> </columnHeader> <columnFooter> <band splitType="Stretch"/> </columnFooter> <pageFooter> <band height="54" splitType="Stretch"/> </pageFooter> <summary> <band height="42" splitType="Stretch"/> </summary> </jasperReport>
  2. If the designer would allow it, you will run into issues when exporting the content to PDF or Excel which do not allow the same field to have multiple formats. Better to create two fields and format each on the way you want. Right Justify the first one and left justify the second one to achieve the same effect.
×
×
  • Create New...