cancel
Showing results for 
Search instead for 
Did you mean: 

splitting string and create multiple segments in idoc

Former Member
0 Kudos

hai

iam getting one xml file

in that one attribute is having the value like this

x1,x2,x3,x4

so i need to split this in to saparete values based on , and pass those values to the idoc .

how can i do this.

can any bady help me pls..........

Edited by: srikanth vipparla on Feb 7, 2008 6:26 AM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You can use *<Stringarrayvariable>.split(",") function to take the individual strings where position can be traversed using a variable.But first you need to get the input values ie x1,x2,x3.. as astring arrray.So you need to pass the whole set of values to a advanced UDF and separate out one by one.

For eg : a.split(0) willgive output as x1.

you can access each of the set of the values like -

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

{

String temp = null;

temp = a.split(",");

//process temp ..

}

Sorry there was a mistake in the solution given earlier,now edited.

Hope this helps !

Regards

Priyanka

Edited by: Priyanka Balagangadharan on Feb 6, 2008 5:05 PM

Edited by: Priyanka Balagangadharan on Feb 6, 2008 5:08 PM

Answers (6)

Answers (6)

Former Member
0 Kudos

Viparla,

If you want to add node for each , then create Queue udf with one argument as input and name the function as AddNode.

Then add this code:

String werks = input[0];

StringTokenizer st = new StringTokenizer(werks,",");

while(st.hasMoreTokens())

{

result.addValue(st.nextToken());

}

Then in mapping source>udf>target.

Regards,

---Satish

Former Member
0 Kudos

my problem is solved thanks for ur help

i fllow the deffarent way

to solve the problem

many thanks for ur help

Jitendra_Jeswan
Contributor
0 Kudos

Can you tell me the source Attribute and target elements , then i will provide u with the UDF code for this..

Regards.

Jeet

Former Member
0 Kudos

Hi,

can you try File content conversion...

Regards,

Nithiyanandam

Former Member
0 Kudos

can u tell me the code(java) for this

Former Member
0 Kudos

and the values are not constant

those can be changed depending on conditions

Former Member
0 Kudos

if u wanna validate and then send to idoc accordingly, u may have 2 create a UDF.