Asuming that you want to print that variable,

add a text field to your Detail section and
set its expression property to something like:
($F{field1}.intValue() == $F{field2}.intValue()) ?
  new Integer(1) :
  new Integer(($F{field2}.intValue() - $F{field1}.intValue()) * 24)

If field1 and field2 are Doubles use Double instead of Integer and
doubleValue() instead of intValue()



On 9/5/06, John Dunn <[EMAIL PROTECTED]> wrote:
> I am using ireports to create my reports and want to calculate a variable
> each time I read a record.
>
> Basically
>
> if field1 = field2 set variable to 1
> else
>   set variable to (field2 - field1) * 24
>
> However I have no idea how to write this variable expresssion because I no
> little java.
>
> Can anyone help?
>
> John
>
>
>
>
>
>
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> jasperreports-questions mailing list
> jasperreports-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jasperreports-questions
>


-- 
Why?
Because YES!

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
jasperreports-questions mailing list
jasperreports-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jasperreports-questions

Reply via email to