Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

removing duplicate values from a queu in graphical mapping

Hi,

Can i remove duplicate values from a queu, but still keep the existing context changes?

Is it possible with graphical mapping (node functions) to go from this queue

<null>
[aaaa]
[aaaa]
[aaaa]
[aaaa]
[bbbb]
[bbbb]
[bbbb]
[contextchange]
[cccc]
[cccc]
[dddd]
[dddd]
[dddd]
[dddd]
[contextchange]
[eeee]
[eeee]
END OF QUEUE

to this queu:

<null>
[aaaa]
[bbbb]
[contextchange]
[cccc]
[dddd]
[contextchange]
[eeee]
END OF QUEUE

The number of times that a value occurs is variable, as is the number of values within a context, as is the number of context changes in the queue.

So, once more, question is how to remove the duplicates while keeping the context changes as they are.

Thx for advice

Kr

Robert

Former Member
replied

Hi,

It'll be little difficult removing duplicates and keeping the context as it is with exixting standard functions. Removing duplicates irrespective of context changes, we can do with available functions. Please try with this UDF code which may help you...

source>sort>UDF-->Target

execution type of UDF is Allvalues of a context.

public void UDF(String[] var1, ResultList result, Container container) throws StreamTransformationException{

ArrayList aList = new ArrayList();

aList.add(var1(0));

result.addValue(var1(0));

for(int i=1; i<var1.length; i++){

if(aList.contains(var1(i)))

continue;

else{

aList.add(var1(i));

result.addValue(var1(i));

}

}

}

Regards,

Priyanka

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question