cancel
Showing results for 
Search instead for 
Did you mean: 

Can any one haelp in writing a UDF for....................

Former Member
0 Kudos

<b>Can any one help in writing a UDF for..........</b>

senario is - for every different value of name in source side i need to create a seperate at target side .This is using <b>message split</b>.

source:-

<b>Message1</b>

Details(unbounded)

-Name satya

-ID 13

Details(unbounded)

-Name Kiran

-ID 14

Target:-

<b>Message1</b>

Details

- Name satya

- ID 13

<b> Message2</b>

Details

- Name Kiran

-ID 14

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi satya,

Please try with this code....you need to create context mapping...It has been tested in my m/c.

public static void MethodTestSDN(String[] name, String[] id,

ResultList result,Container container){

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

if(name<i>!=null && !name<i>.equals("")){

result.addValue(name<i>);

result.addValue(id<i>);

}else{

result.addContextChange();

}

System.out.println("Name:"+name<i>);

System.out.println("Id:"+id<i>);

}

}

public static void main(String[] args) {

ResultListImpl result = new ResultListImpl();

Container container = null;

String a[] = {"Satya",ResultList.CC,"Kiran"};

String b[] = {"1",ResultList.CC,"2"};

MethodTestSDN(a,b,result,container);

}

Result:

<b>Name:Satya

Id:1

Name:__cC_

Id:__cC_

Name:Kiran

Id:2</b>

Former Member
0 Kudos

My requriement is still not met

May be u are using both name and id for the context change.

former_member214364
Active Contributor
0 Kudos

Hi Satya,

Could you please send complete source and target structures to jag.int@gmail.com id.

and i want to confirm that, will you get duplicate Names in source message?

Cheers,

Jag

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

You do not need a UDF for this.

Map the Details tag from the source to the Root tag of your message in the target./

This will ensure that for every Details Node in the source the Root is created in the target.

Regards

Bhavesh

Former Member
0 Kudos

May its not possible coz

I have one source message type(S1) and two target message types(M1,M2)

In the mapping using the message tab have selected them.

S1

name

id

M1

name

id

M2

name

id

If i do as u said it will create a n detail nodes under the same message.

But my requriement is to create a detail node of every different value under different message like message1, message1..........