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

How to assign oldValue to a Variable


2005 IR Help

Recommended Posts

By: dharmendra - dharamg7

How to assign oldValue to a Variable

2004-11-03 00:33

hi there

i want to keep just old value of a filed of detail band so how can i assign oldValue of a field ie Filed.oldValue() to a variable.... in reports xml file .. i m using ordesigner as GUI tool

 

 

 

 

By: Tobias Gaekle - ike987

RE: How to assign oldValue to a Variable

2004-11-03 02:06

do not crosspost please.

 

an idea is to define two variables where one of them is updated with every new row.

 

say you already have a count variable 'rowCount', the expression for the first variable (evenVariableName) could look like this:

 

$V{rowCount}.intValue() % 2 == 0

? $F{theField}

: $V{evenVariableName}

 

if it is a even row, the variable will save the value of theField, else it will just return its own value (=do nothing). the second variable saves the value for odd rows:

 

$V{rowCount}.intValue() % 2 == 1

? $F{theField}

: $V{oddVariableName}

 

when you have these two, you could use a printWhenExpression or another variable to show the proper old value in the detail band:

 

$V{rowCount}.intValue() % 2 == 0

? $V{oddVariableName}

: $V{evenVariableName}

 

hth

 

 

 

 

By: dharmendra - dharamg7

RE: How to assign oldValue to a Variable

2004-11-03 03:24

thx Tobias

& sorry for crosspost........

now tell me how do i create rowCount Variable

 

thx

 

 

 

 

By: Tobias Gaekle - ike987

RE: How to assign oldValue to a Variable

2004-11-03 03:59

use calculation type Count or define a variable like this:

 

 

<variable name="rowCount" class="java.lang.Integer" resetType="Report" calculation="Nothing">

<variableExpression><![CDATA[

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

]]></variableExpression>

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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