Compare current row with previous row value
I am new to developing reports in BIRT. can someone help me in determining how to obtain previous row value. I want to compare current row value with previous row value. There are three columns in my report. I have grouped the data on first column and the detail rows has first, second and third column. It is the second column on which I want to compare current row with previous row value. Lets call the second column as Shifttime and it's a date time data type attribute
Comments
-
You could use a computed column on your data set to hold the previous row value in a persistent variable. There is an example in these forums at https://communities.opentext.com/forums/discussion/comment/221072#Comment_221072
Warning No formatter is installed for the format ipb0 -
Thanks I did that, but it returned some random values (It did not return previous row values but random values from the dataset). I have used a group by on one of the columns and have sorting applied on that column in ascending manner. Did that cause this to return random results. The expression I used in the computed column is below: (Day is my base column for which I want previous values to return, it's a integer data type). Appreciate your response!
Prevval (computed column) has following expression:
var currentRow = row["Day"]; //Get current data rowvar previousRow = reportContext.getGlobalVariable("previousRow"); //Get global variable value
if(currentRow==null){reportContext.setGlobalVariable("previousRow",null);} //Check for null and set null
else{reportContext.setGlobalVariable("previousRow",currentRow);} //Or assign global variable to current row value
previousRow;0
Categories
- All Categories
- 107 Developer Announcements
- 53 Articles
- 105 General Questions
- 142 IM Services
- 43 OpenText Hackathon
- 32 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 898 Cloud Fax and Notifications
- 76 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 118 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management