cancel
Showing results for 
Search instead for 
Did you mean: 

Creating target field based on input node

justin_santhanam
Active Contributor
0 Kudos

Hi all,

I'm facing a problem in creating the target node based on input node. See if the input node value is repeated I don't want to create the target field for the second occurrence.

<?xml version="1.0" encoding="UTF-8"?>

<ns0:MT_temp xmlns:ns0="urn:test">

<row>

<temp_id>1002</temp_id>

</row>

<row>

<temp_id>1002</temp_id>

</row>

</ns0:MT_ItemEvent>

In the above structure you can see the temp_id is repeated , I want to create only one target node. Plz help me to solve this.

Accepted Solutions (0)

Answers (1)

Answers (1)

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

so what do you want to do with the rest?

concat?

or always use the first one ?

if you always want to use the first one create a simple UDF

that will take all values (type queue) but in result.addValue()

output only the first one

Regards,

michal

justin_santhanam
Active Contributor
0 Kudos

Michal,

I don't want to concat. For example if the first two temp_id is 1003 and third temp_id is 1004. Then I've to create one target node for the first two reoccurrances and the other target node for the non-repeating element.

Thnxs,

Raj

Former Member
0 Kudos

HI,

Use the UDF and in that use Vector to create the result list with the values.

use temp_id as imput and before that remove context

after the UDF use the Splitbyvalue

See the below code

String () a;

Vector prod = new Vector();

for (i=0;i<a.length;i++){

if(!prod.contains(a(i))) prod.add(a(i));

}

Collections.sort(prod);

for(i=0;i<prod.size();i++){

result.addValue((String) prod.get(i));

}

Regards

Chilla

justin_santhanam
Active Contributor
0 Kudos

Michal & Chilla,

Thanks a lot for ur inputs.

Regards,

Raj