Jump to content
Changes to the Jaspersoft community edition download ×

a count is false


sbenbli

Recommended Posts

  • Replies 9
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I guess you could try to write your $F{yesno} value somewhere to be sure that it's value is 1 or 0.

 

Assuming, you have groups in your report try doing as follows:

 

Variable - test

Variable class - java.lang.Integer

Calculation type - System

Reset type - group

Initial Value Expression:

($V{test} != null)

?

($F{yesno}.intValue() == 0)

?

(new Integer($V{test}.intValue() + 1))

:

(new Integer($V{test}))

:

(new Integer(1))

Link to comment
Share on other sites

it sign error why

net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file: 1. The constructor Integer(Integer) is undefined value = (java.lang.Integer)((((((java.lang.Long)field_yesno.getValue()).intValue() == 0)?(new Integer(((java.lang.Integer)variable_nbraudela.getValue()).intValue() + 1)):(new Integer(((java.lang.Integer)variable_nbraudela.getValue()))))));/*$JR_EXPR_ID=17$*/ <---------------------------------------------------------------> 2. The constructor Integer(Integer) is undefined value = (java.lang.Integer)((((((java.lang.Long)field_yesno.getOldValue()).intValue() == 0)?(new Integer(((java.lang.Integer)variable_nbraudela.getOldValue()).intValue() + 1)):(new Integer(((java.lang.Integer)variable_nbraudela.getOldValue()))))));/*$JR_EXPR_ID=17$*/ <------------------------------------------------------------------> 3. The constructor Integer(Integer) is undefined value = (java.lang.Integer)((((((java.lang.Long)field_yesno.getValue()).intValue() == 0)?(new Integer(((java.lang.Integer)variable_nbraudela.getEstimatedValue()).intValue() + 1)):(new Integer(((java.lang.Integer)variable_nbraudela.getEstimatedValue()))))));/*$JR_EXPR_ID=17$*/ <------------------------------------------------------------------------> 3 errors at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:193) at it.businesslogic.ireport.IReportCompiler.run(IReportCompiler.java:578) at java.lang.Thread.run(Unknown Source)

 

 

thank you

Link to comment
Share on other sites

Ohhh, I thought that you want to increment your variable if field number is equal to 1 :/ My bad, sorry.

 

So I guess you should make two variables than, the same way :)

 

Variable #1 = YesCnt

 

($V{YesCnt} != null)

?

($F{yesno}.intValue() == 1)

?

(new Integer($V{YesCnt}.intValue() + 1))

:

(new Integer($V{YesCnt}.intValue()))

:

(new Integer(1))

 

 

Variable #2 = NoCnt

($V{NoCnt} != null)

?

($F{yesno}.intValue() == 0)

?

(new Integer($V{NoCnt}.intValue() + 1))

:

(new Integer($V{NoCnt}.intValue()))

:

(new Integer(1))

 

Try this and let me know if it fulfills your needs :)

Link to comment
Share on other sites

thank you mar_ass I found the solution, I make the sum of all the column $F{yesno} and since it's composed of 0 and 1 it's going to make the sum of 1 and has that is then the account

the account of 0 I make the total of this $F{yesno}-count of 1 and here is the account is good

is a logic !

thank you another time

:woohoo:

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...