cancel
Showing results for 
Search instead for 
Did you mean: 

UDF for converting source node to target single node array

Former Member
0 Kudos

Hello gurus,

Please help me with the following scenario.

I have a node with multiple elements in the source message like this;

Source_message

node1

ele1

ele2

ele3

Assume the value of ele1, ele2 ele3 as 1,2 and 3.

target_message

node1

ele

need an udf which can convert all the elements into single node arrey into target message

target_message

node1

1 2 3

Please let me know if any one had tried out similar UDF.

Thanks

sneha

Accepted Solutions (1)

Accepted Solutions (1)

madhusudana_reddy2
Contributor
0 Kudos

Hi Snehalatha,

Use below code

public voidcalculate(String var1, ResultList result, Container container)

StringBuffer sb = new StringBuffer();

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

{

sb.append(var1<i>);

}

result.addValue(sb.toString());

Note:- select advanced userdefined function that means in PI7.1 function catagory is all values of context.

and select source node context to root node.

thanks,

madhu

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Sneha

It is simple, you can use multiple concat() functions or

you can use this simple java code.

return a + b + c + .......

Hope this will solve your purpose

Subba Rao

Former Member
0 Kudos

Hi

You can use concat (Text) function for this


ele1
        -- > Concat ----->
ele2
                                      --concat----> Target
ele3-------------->


      

Regards

Ramg

Edited by: Ramkumar Ganesh on May 24, 2010 8:43 PM

Edited by: Ramkumar Ganesh on May 24, 2010 8:44 PM

Former Member
0 Kudos

HI Sneha,

You can use standard function CONCAT.

ELE1 concat ELE2 then concat this output with ELE 3.

Use space as the delimiter of CONCAT.

Thanks,

Uaruna

former_member187339
Active Contributor
0 Kudos

Hi Sneha,

No need of UDF here, you can use the standard node function Concat for this requirement. You need to use it twice in the mapping

Regards

Suraj