Collection of dates as a parameter?


Is it possible to use dates (java.sql.Date, java.sql.Time, java.sql.Timestamp or java.util.Date) as a collection when creating a parameter?

I want an input control where you select multiple dates that are returned by a SQL query. Then the report query would have a WHERE clause using $X{IN, date_column, date_parameter}. This works for other data types, but the $X{IN, , } function appears to not work with dates. I get

ERROR: operator does not exist: date = character varying
Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.

My database is PostgreSQL, if that makes a difference.

An example report would be:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 
     using JasperReports Library version 6.6.0 -->
<jasperReport xmlns=""
              name="Blank_A4" pageWidth="595" pageHeight="842"
              columnWidth="555" leftMargin="20" rightMargin="20"
              topMargin="20" bottomMargin="20"
    <property name="" value=""/>
    <property name=""
              value="izziWorks24 Data Adapter "/>
    <parameter name="Parameter1" class="java.util.Collection" nestedType="java.util.Date"/>
    <queryString language="SQL">
        <![CDATA[select foo.date_col as col1 from (SELECT current_date as date_col) as foo where $X{IN, foo.date_col, Parameter1}]]>
    <field name="col1" class="java.sql.Date">
        <property name="" value="col1"/>
        <band splitType="Stretch"/>
        <band height="79" splitType="Stretch"/>
        <band height="35" splitType="Stretch"/>
        <band height="30" splitType="Stretch">
                <reportElement x="0" y="0" width="100" height="30"
                    <property name=""
        <band height="30" splitType="Stretch">
                <reportElement x="0" y="0" width="100" height="30"
                    <property name="
        <band height="45" splitType="Stretch"/>
        <band height="54" splitType="Stretch"/>
        <band height="42" splitType="Stretch"/>

craig_25's picture
Joined: Nov 22 2018 - 10:51am
Last seen: 1 month 2 days ago

0 Answers:

No answers yet