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


  • Virgil
    Virgil Administrator EM admin
    edited October 18, 2017 #2

    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

    Warning No formatter is installed for the format ipb
  • 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 row

    var 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