Confusion regarding tMemorizeRows

One Star

Confusion regarding tMemorizeRows

I have a following situation where my input is like:
|name | sal |
|aa | 1111 |
|bb |2222 |
|cc |3333 |
|dd | 4444 |
Now ,I want to obtain the difference between two consecutive "sal" using tMemorizeRow component, and for the same I have ticked in the "sal" checkbox of memorize column in tMemorizeRow component and number of rows to be memorized =2.

For the same I have written the following code in tJavaFlex:
row6.sal =(sal_tMemorizeRows_1== null || sal_tMemorizeRows_1 == null ) ? 0 :sal_tMemorizeRows_1 - sal_tMemorizeRows_1 ;
But the output obtained is :
|name | sal |
|aa | 0 |
|bb |-1111 |
|cc |-1111 |
|dd |-1111 |
Now when I interchange sal_tMemorizeRows_1 and sal_tMemorizeRows_1 ,the output obtained is :
|name | sal |
|aa | 0 |
|bb |1111 |
|cc |1111 |
|dd |1111 |
My doubt is whether _tMemorizeRows_1 points to the "preceding" row or to the "succeding" row.??
Please do revert back if you have any idea about it.

Re: Confusion regarding tMemorizeRows

For tMemorizeRow
means to refer to the current row.
means to refer to the previous 1 row.
Best regard
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.



Introduction to Talend Open Studio for Data Integration.


Downloads and Trials

Test drive Talend's enterprise products.