1
votes

Hi all am using a java transformation in my mapping and added the code in it

for(int i=0;i<3;i++)
{
     EMP_NAME1=">>"+EMP_NAME+"<<";
     EMP_ID1=EMP_ID;
}

I expect the rows should be inserted 3 times.

But it is done once,string concatenated with >> <<.

Also can anyone explain me what is the difference between active and passive java transformation.

I have created the passive one in any case will it be the reason?

Thanks in advance.

2

2 Answers

2
votes

You need to call generateRow() inside the loop. Java transformation emits a new row every time this function is executed.

Active transformations change the number of rows passing through them. On the contrary, if the number of input rows is equal to output rows, then the transformation is called passive. You should use the former.

0
votes

you need to use generateRow function to generate new records.

A sample program to create new records for student and their subject marks can be found as below.

String [] sub_list;
String sub_delimiter =”,”;
String [] subject_mark;
string mark_delimiter = “=”;
sub_list = SUBJECT_WITH_MARKS.split(sub_delimiter);
o_STUDENT_NO= STUDENT_NO;
for (int i=0; i < sub_list.length ;i++) {
subject_mark = sub_list.split(mark_delimiter );
o_SUBJECT =subject_mark[0];
o_MARK =Double.parseDouble(subject_mark[1]);
generateRow();
}

You can see how to use java transformation in informatica for more details.