I believe this is a timing issue with the page variable and the data set events. It looks like you are getting the last one in. I generally stay away from putting per row code in the data set (Except the actual script for retrieving data) and instead generally put them on the report item that actually uses the data (In most cases this is a onRow event in a table). Another thing you could try is to use a reportContext.setGlobablVariable function or use the page variable but make it an array with the row number as the element number.