[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.birt] Re: How to calculate difference between current and previous row?

Hi Jason,

i'm using a Flat File Datasource not a scripted one, so i can't calculate it there. Or did i miss a thing?

I got it working using a calculated column inside the chart, only there i have access to the rownumber. But i would prefer a solution inside the original datasource.

Tobias

Jason Weathersby wrote:
Tobias,

To get the previous value you could create a computed column to do this.

First in the dataset beforeOpen script add a JavaScript variable like this:

prevVal = 0;

Then add a computed column like this:
var tPrevVal = prevVal;
prevVal = row["thecolumniwantthepreviousvaluefrom"];
tPrevVal;

The only value that will really  not be valid is the first.

Jason



Tobias Mayer wrote:
Hi,

ich have a CSV-File containing one column with Date values. Now i need to somehow create another column containing the difference of days between the current row and the previous one. I found out how i could calculate this difference, but i don't know how i can access the data of the previous row. Any suggestions/solution?

TIA
Tobias Mayer