Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
931 views
in Technique[技术] by (71.8m points)

jasper reports - Jaspersoft ireport - Variable not found

I am working with my company's project. It uses Java Spring and Jaspersoft ireport 3.7.6 to print report.

I want to modify an exist report form (file jrxml). I want to sum a variable of 2 columns.

Data of these columns like

0/2/3/0

0/2/3/0=5

0/0/0/1

0/0/0/1=1

I have to calculate total of numbers which is behind '='.

I followed the solution in How to sum all values in a column in Jaspersoft iReport Designer?

I created a "GRAND_TOTAL" variable with caculation: "Sum", Class: "java.lang.Integer", resetType:"Report", incrementType:"none"

I added this condition to variableExpression

new Integer(($F{FullQty}.contains("=")) ? (Integer.valueOf($F{FullQty}.split("=")[1]).intValue() + Integer.valueOf($F{EmptyQty}.split("=")[1]).intValue() ) : (0))

When I print report, it shows error :

net.sf.jasperreports.engine.design.JRValidationException: Report design not valid :

1. Variable not found : GRAND_TOTAL

Please help me!

question from:https://stackoverflow.com/questions/65841702/jaspersoft-ireport-variable-not-found

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I found the solution! My company's project use dynamic report. Therefore, I have to use fastReportBuilder to add variable in java code.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...