Jump to content
We've recently updated our Privacy Statement, available here ×

How to not print-show zero values ?


2004 IR Help

Recommended Posts

By: Luciano Zanin - cianoz

How to not print-show zero values ?

2004-03-25 06:40

Hallo, i'm using iReport 0.2.3.

How can i do to not print zero values ?

 

I have some fields that contain 0 (not "null") and i don't want the zeros appear in the report.

I tried to specify a "#,###" pattern or to set the "blank when null" property but they don't perform the result i expect.

Could i have a suggestion ?

 

 

 

 

By: Mark Rhodes - mrhodes2

RE: How to not print-show zero values ?

2004-03-25 09:14

Use the print when expression.

 

New Boolean($V{yourvariable}.doubleValue()<>0)

 

 

 

 

By: Luciano Zanin - cianoz

RE: How to not print-show zero values ?

2004-03-25 23:31

Sorry for my inexperience, but how do i define the variable ?

I guess it shoud refer to my "field1" (that is the field with possible zero values), but how ?

 

 

 

 

By: Rick Millar - rmillar

RE: How to not print-show zero values ?

2004-03-26 08:27

I think what you want to reference in the printwhen expression for your field is the following modification to Mark's solution:

 

New Boolean($F{yourFieldName}.doubleValue()<>0)

 

 

 

 

By: Luciano Zanin - cianoz

RE: How to not print-show zero values ?

2004-03-27 00:41

Rick, you guess right, but i have already tried what you suggest and i get no result because i can't compile the report. I get this compiling error:

 

Errors compiling M:statisticssaie204rep1.jasper! C:ProgrammiiReportcontatti_saie2_ori_1.java:172: ')' expected value = (java.lang.Boolean)(New Boolean(((java.lang.Double)field_addetti.getValue()).doubleValue()<>0)); ^ C:ProgrammiiReportcontatti_saie2_ori_1.java:380: ')' expected value = (java.lang.Boolean)(New Boolean(((java.lang.Double)field_addetti.getOldValue()).doubleValue()<>0)); ^ C:ProgrammiiReportcontatti_saie2_ori_1.java:588: ')' expected value = (java.lang.Boolean)(New Boolean(((java.lang.Double)field_addetti.getValue()).doubleValue()<>0)); ^ 3 errors dori.jasper.engine.JRException: Errors were encountered when compiling report expressions class file: See error messages above. at dori.jasper.engine.design.JRAbstractJavaCompiler.compileReport(JRAbstractJavaCompiler.java:154) at dori.jasper.engine.design.JRDefaultCompiler.compileReport(JRDefaultCompiler.java:136) at dori.jasper.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:135) at dori.jasper.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:123) at it.businesslogic.ireport.IReportCompiler.run(IReportCompiler.java:148) at java.lang.Thread.run(Thread.java:534)

 

Could you help me, please ?

 

 

 

 

By: Rick Millar - rmillar

RE: How to not print-show zero values ?

2004-03-29 08:30

Cianoz,

 

Sorry, I did not test the expression. I just modified what mark has originally posted. The part of the expression that is causing it to blow up is the relational comparison operator "<>." It is not a valid operator. Try this instead:

 

new Boolean( $F{yourfieldname}.doubleValue()<0 || $F{yourfieldname}.doubleValue()>0)

 

 

 

 

By: Luciano Zanin - cianoz

RE: How to not print-show zero values ?

2004-03-29 08:46

This works ! :-)

Thanks a lot Rick ! (also to Mark, sure)

 

It's nice when solutions to little problems bring great satisfactions !

 

 

 

 

By: Rick Millar - rmillar

RE: How to not print-show zero values ?

2004-03-29 09:11

Molto Buono!

Link to comment
Share on other sites

  • 9 years later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

  • 2 years later...

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...