cancel
Showing results for 
Search instead for 
Did you mean: 

splitting string and create multiple segments in idoc

Former Member
0 Kudos

ha i friends

i got one requirment in that my source file is like this

<name>xyz</name>

<group>a1,a2,a3,a4</group>

<type>abc</type>

then i need to convert it into target system as like this

<name>xyz</name>

<group1>

<group>a1</group>

<group>a2</group>

<group>a3</group>

<group>a4</group>

</group1>

<type>abc</type>

so what can i do for this

the group values are not constant those depending on the

inputs.

can any body help me

iam trying to write one UDF function

but iam not getting the out put

pls any body can help me

pls

many thanks with advance

Edited by: srikanth vipparla on Feb 7, 2008 11:18 AM

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

dear srikant,

your problem can be solved by using context handling.

in context handling u have to use two node function

1) remove context

2)splitbyvalue()

for this please check the link

/people/riyaz.sayyad/blog/2006/04/23/introduction-to-context-handling-in-message-mapping

/people/sravya.talanki2/blog/2005/08/16/message-mapping-simplified--part-i

if u want more document please give ur Email Id

I have some document which is realy helpfull for u....

regards,

navneet

Email-navneet_sumit@satyam.com

Former Member
0 Kudos

iam writing UDF like this

it is working

but it is giving one value onle

ex: sri,kanth

in this iam getting

sri only

iam not getting

kanth

finally i want out put in this format

sri

kanth

the code is

String [] vals = null;

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

vals = a[j].split(",");

result.addValue(vals[j]);

}

so pls help me

Former Member
0 Kudos

Hi,

the output will be only vals not vals.

can u please reply to my thread.

Thnx

Chirag

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

Former Member
0 Kudos

hi srikant,

cud you please let us know how you solved this kind of requirement.

We have a similiar kind of problem.

many thanks if you can throw more light.

regards

ahmed

Former Member
0 Kudos

hai use above java code for splitting

or

else

use this

String[] result1=a[0].split(",");

for (int x=0; x<result1.length; x++)

result.addValue(result1[x]);

to spit the value

thanks

srikanth vipparla.

Former Member
0 Kudos

thanks buddy.

Former Member
0 Kudos

is it working good for u?

it is not working for me .

i meen it is working for one segment

when the root segment is repetaing then it is not working can pls help me on this.

henrique_pinto
Active Contributor
0 Kudos

You have to have two loops: 1 for the input queue and other for the splitted queue.

It should be something like this:

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

Regards,

Henrique.

Former Member
0 Kudos

ha friend

iam doing first conctinating and then splitting

when concatinating to concatinate iam using remove context for concatinating at that time all the segmaents text will comming into one segment

what can i do to avoid this .

pls help me

with regards

srikanth vipparla

Former Member
0 Kudos

Hi srikanth ,

this is not possible with graphical mapping.

You have to use XSLT, JAVA or ABAP Mapping.

It is just possible in graphical mapping if you know how many target field have to be generated. If you knwo it is always e.g. "four" like in you sample.

You could dupicate the subtrees in in the target message.

In the first mapping write the entire queue into the gobal container element.

In mapping 2,3 and 4 read the global container an give back the entries that you splittet befor in a udf.

regards Mario

Former Member
0 Kudos

Hi,

the value which is coming in Group node is always 4 or the occurance of it not known.

If it is only 4 then u can use the dublicate target node function create 4 target node using that function and use the substring function to fetch the required value.

this can be done by right click on target node and select dublicate node.Create it 4 times and use that.

Thnx

Chirag