简体   繁体   中英

JasperReport Server - Interactively Filtering with own Java Data-Type doesn't work

I have created my own Java Class (type) to have life just a little easier when displaying money (euro)-values in jasper reports.

    public class Euro extends Number implements Comparable<Euro> {

    @Override
    public String toString() {...}

    @Override
    public boolean equals(Object obj) {...}

   @Override
   public int hashCode() {...}

}

The data is displayed in table and everything works fine. Even sorting the whole column works great. But, if i want to filter the column like "is greater than" - no data is displayed after filtering.

When i changed the type of the data to BigDecimal sorting works.

What i'm doing wrong? Or can anyone tell me what exaclty jasper do when it tries to filter data?

The problem was hat jasper doesn't know the correct data-type of the column, which should be filtered.

So, you have to define which field or variable should be filtered:

The columns in the table that are neither sortable nor filterable contain complex formulas in their detail text field expressions. JIVE looks at the expression in the detail text field to understand what is the data source field or variable it needs to sort and filter after. When the text field uses a simple expression with only the name of a field or variable, things work smooth.

Another approach is to [...] specify at column level in the table component, which is the field or variable to use for sorting and filtering, using one of the following two custom properties that can be set in the column tag/object:

net.sf.jasperreports.components.table.column.field
net.sf.jasperreports.components.table.column.variable

How to make JIVE filtering/soring feature work on column in the table that contains expression

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM