Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
RAJ6
Contributor III
Contributor III

How to use SQL Lag Function concept in talend

Hi Talend Folks,

 

Labels (1)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi there,

 

This sort of thing can be done very easily in a tJavaFlex component, as follows.

 

0683p000009Lre5.png

 

The tFixedFlowInput generates rows with a single Integer column:

 

0683p000009LrfD.png

 

Add a new column to the output schema of th tJavaFlex component for the LAG value:

 

0683p000009LrEc.png

 

And the the following code will output the previous (LAG) value, before setting it to the current value of newColumn, which will be available when the next row is processed:

 

0683p000009LrQU.png

 

Regards,

 

 

Chris 

View solution in original post

2 Replies
Anonymous
Not applicable

Hi there,

 

This sort of thing can be done very easily in a tJavaFlex component, as follows.

 

0683p000009Lre5.png

 

The tFixedFlowInput generates rows with a single Integer column:

 

0683p000009LrfD.png

 

Add a new column to the output schema of th tJavaFlex component for the LAG value:

 

0683p000009LrEc.png

 

And the the following code will output the previous (LAG) value, before setting it to the current value of newColumn, which will be available when the next row is processed:

 

0683p000009LrQU.png

 

Regards,

 

 

Chris 

Anonymous
Not applicable

use sort before that to get lead functionality..