Jaspersoft Studio 或者 IReport 中报错字符类型转换错误
1、在 Java 程序中,调用 Jaspersoft Studio 或者 IReport 报表时
Cannnot print reports; Errors : Errors were encountered when compiling report expressions class file:
1. Cannot cast from BigDecimal to Integer
value = (java.lang.Integer)(((java.math.BigDecimal)field_DELY_QTY.getValue()));//$JR_EXPR_ID=26$
<-------------------------------------------------------------------->
2. Cannot cast from BigDecimal to Integer
value = (java.lang.Integer)(((java.math.BigDecimal)field_TOTAL_CART.getValue()));//$JR_EXPR_ID=27$
<---------------------------------------------------------------------->
3. Cannot cast from BigDecimal to Float
value = (java.lang.Float)(((java.math.BigDecimal)field_DELY_SQFT.getValue()));//$JR_EXPR_ID=28$
<------------------------------------------------------------------->
4. Cannot cast from BigDecimal to Float
value = (java.lang.Float)(((java.math.BigDecimal)field_NET_WEIGHT.getValue()));//$JR_EXPR_ID=29$
<-------------------------------------------------------------------->
2、Jaspersoft Studio 或者 IReport 字段类型的配置(使之字段类型一直)
IReport 查看 SQL 语句中字段的类型
路径:数据->报表查询
Japsersoft Studio 查看 SQL 语句中字段的类型
以下右击进入 Dataset and Query Dialog