Thursday, February 26, 2015

tMemorizeRows Example in Talend

Sample Data: In source schema we have a field PRODUCT_CODE.

PRODUCT_CODE
---------------------------
prod01
prod02
prod03
prod04
prod02
prod04


Use case:
Let say we want to find out duplicate PRODUCT_CODE by using tMemorizeRows.




In above image note the row count to memorize is set to 2. It means this component will memorize 2 rows.

tJavaRow code:

String s="";

if(PRODUCT_CODE_tMemorizeRows_1[0].equals(PRODUCT_CODE_tMemorizeRows_1[1]))
{
s=PRODUCT_CODE_tMemorizeRows_1[0];
System.out.println("OUTPUT...");
System.out.println(s);
}


PRODUCT_CODE_tMemorizeRows_1[0] will give you first index value.
Note: tMemorizeRows_1 perpend the column name.

Final Output:
OUTPUT...
prod02
OUTPUT...
prod04

1 comment: