cancel
Showing results for 
Search instead for 
Did you mean: 

How to split value which separate by ","

park_saeiam
Explorer
0 Kudos

Hi all

Could you please to help this?

If I have src message like this

<item>

<f1>aa</f1>

<f2>bb</f2>

<f3>1,2,3</f3>

</item>

and need to target message like this

<item>

<f1>aa</f1>

<f2>bb</f2>

<f3>1</f3>

</item>

<item>

<f1>aa</f1>

<f2>bb</f2>

<f3>2</f3>

</item>

<item>

<f1>aa</f1>

<f2>bb</f2>

<f3>3</f3>

</item>

Could you please to tell me how I can do?

Thanks

Park

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI,

Use UDF

write for example

substring(indexOf(",")+1,1) , not sure try with these combination and use splitbyvalue Graphical mapping function and map to targt sure you will get , before that your target side occurr should be more like 0..unbound not 1. and copy the f1,f2 with copyvalue GM function.

Regards

Chilla..

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Park,

Create a UDF....Give its input as f3 node......in the UDF for each values of f3, do in resultlist.addValue("true");

Now for item node mapping do below:

f3 node -> UDF ->creatif -> Item Node

This will create your multiple Item nodes.

For f1 do:

f1 ->f1

For f2 do:

f2 ->f2

Create a second UDF, in that do resultlist.addValue(x); were x is your f3 comma-separated data.

For f3 do:

f3 ->second UDF -> splitbyvalue ->f3

This may solve your query.

Thanks,

Rajeev Gupta

Message was edited by:

RAJEEV GUPTA

Former Member
0 Kudos

Hi,

Correct as venkataraman said ,i hope sure it will work whatever iexplained above he used.

Regards

Chilla..

Former Member
0 Kudos

Hi Park,

Go about like this.

Create a UDF:

Give <f3> as input to UDF. Select type as Queue.

input variable: a


String[] vals = a[0].split(",");
for(int j=0; j<vals.length; j++){
  result.addValue(vals[j]);
}

Now map the target nodes in the following way:

<f3> -


> UDF -


> <item>

<f1> -


> copyValue(standard function in constant category>) -


> <f1>

<f2> -


> copyValue(standard function in constant category>) -


> <f2>

<f3> -


> UDF -


> SplitByvalue(Node function) -


> <f3>

Regards,

P.Venkat

Former Member
0 Kudos

Hi Park,

You need a UDF where you have to write/read the global container element (GCE).

You have to split 1,2,3 into an array.

In the GCE you inkrement a counter.

1) In the initial call return array[0] //GCR = 0

2) second call UDF return array[0] //GCR = 1

3) second call UDF return array[0] //GCR = 2

As Sreeram told, you useoneasmany.

Regards Mario

Mario Müller

Former Member
0 Kudos

Hi Park,

Use node function and if required use user defined Function.

use Useoneasmany as node function to replaciacate <F1><F2> use UDF to sperate <F3>

Please reward points

Regards

Sreeram.G.Reddy