简体   繁体   English

JasperReport Server-使用自己的Java数据类型进行交互式过滤不起作用

[英]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. 我创建了自己的Java类(类型),以便在碧玉报告中显示货币(欧元)值时,生活会更轻松一些。

    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. 当我将数据类型更改为BigDecimal时,排序工作正常。

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. 问题是hat jasper不知道应该过滤的列的正确数据类型。

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. JIVE查看详细信息文本字段中的表达式,以了解什么是数据源字段或需要对其进行排序和过滤的变量。 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: daccess-ods.un.org daccess-ods.un.org另一种方法是使用可在列标记/对象​​中设置的以下两个自定义属性之一,在表组件的列级别上指定用于排序和过滤的字段或变量:daccess-ods.un.org daccess-ods.un.org

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 如何使JIVE筛选/排序功能在包含表达式的表中的列上起作用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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