Four Stars

comparing the previous row and the current row ?

Hi,
Which component can I use to compare the previous row and the current row ?
I have many rows with a same column (id), and I want to extract the rows how have the same (Id), transforming this group and loading this in other output format .
the data is sorted in a delimited file like that:
id ref cust order
4020271;256554151;48.1416263;11.5411444
4020271;267508462;48.1406333;11.5421018
4020271;21585826;48.1449059;11.5411711
4020271;21585827;48.1444666;11.5407244
4513917;268472655;48.1437282;11.5405855
4513917;21324374;48.1448788;11.5426666
4513917;268098198;48.1443744;11.5416427
23692591;256554151;48.1416263;11.5411444
23692591;267508462;48.1406333;11.5421018
23692591;21585826;48.1449059;11.5411711
24608314;256554151;48.1416263;11.5411444
24608314;267508462;48.1406333;11.5421018
Thanks an advance.
7 REPLIES
Not applicable

Re: comparing the previous row and the current row ?

Do you want to extract the columns with one special ID or do you want to generate a new output for each new ID ?
Regards,
Theo
Four Stars

Re: comparing the previous row and the current row ?

Hi,
I want to make transformation for all row how have the same Id in context of Extract-Transform-Load directly in Buffer how have a defined shema.
I try to use tjavaFlex with buffer to do that but I have a problem with using Buffer variable in tjavaFlex,I don't know if TOS give possibilities to use component variable (Metadata attribuite) in java component.
I think that is the same way of tSortrow (virtual component) but using agregation of rows how have the same Id :

String thisS<%=colname %> = String.valueOf(this.<%=colname %>);
String otherS<%=colname %> = String.valueOf(other.<%=colname %>);
if(!thisS<%=colname %>.equals(otherS<%=colname %>)){
<%
if(asc){
%>
return thisS<%=colname %>.compareTo(otherS<%=colname %>);
<%
}else{
%>
return otherS<%=colname %>.compareTo(thisS<%=colname %>);
<%
}

Thanks
One Star

Re: comparing the previous row and the current row ?

Hello. Geomati have you found any further solutions to this problem?
I have a similar situation where my input has several rows with matching id's and I must compose these into a single row.
One Star

Re: comparing the previous row and the current row ?

Hello together,
months ago I wrote a article about mergint n rows to one. May be this could help you. If not. Can you please give some more details about your input and output.

Bye
Volker
One Star

Re: comparing the previous row and the current row ?

Thanks for the reply Volker. I was able to solve my problem with some assistance from your use case, however I had to do some things differently. As the rows in my input data were all very similar, it wasn't possible to use the filter component. I had to use JavaRow to incrementally combine each record, aggregate row to identify the most complete row for each record and finally tJoin to pick out the records from step 1.
If anyone has this same problem to solve, or is interested in how the solution works, post back and I'll take pictures of my job.
One Star

Re: comparing the previous row and the current row ?

You are welcome.
And if you would like to share your solution I think there is no problem to add a new use case (or add some more information to my one).
Bye
Volker
One Star

Re: comparing the previous row and the current row ?

Hi All,
Let's assume that i had two tables one is having fresh data and another one is having lookup data.
see the above screen shot i want outputs like that. even if single cell having modified also we treat that is unmatched.so how can we do this 
Thanks In advance.