Six Stars

How to use SQL Lag Function concept in talend

Hi Talend Folks,

 

1 ACCEPTED SOLUTION

Accepted Solutions
Six Stars

Re: How to use SQL Lag Function concept in talend

Hi there,

 

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

 

LagFunctionJob.png

 

The tFixedFlowInput generates rows with a single Integer column:

 

tFixedFlowInput3.png

 

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

 

tJavaFlexSchema3.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:

 

tJavaFlexCode.png

 

Regards,

 

 

Chris 

1 REPLY
Six Stars

Re: How to use SQL Lag Function concept in talend

Hi there,

 

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

 

LagFunctionJob.png

 

The tFixedFlowInput generates rows with a single Integer column:

 

tFixedFlowInput3.png

 

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

 

tJavaFlexSchema3.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:

 

tJavaFlexCode.png

 

Regards,

 

 

Chris