cancel
Showing results for 
Search instead for 
Did you mean: 

concatinate and splitting error

Former Member
0 Kudos

hai friends

iam doing idoc to file senario in that iam geeting multiple tdline (long text) in multiple segments

iam doing first conctinating and then splitting in to 4 parts.

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

my in put file is like this :

<root>

<seg1>

<tdname>abc</tdname>

<seg2>

<tdline>kdjfkdjfhkj</tdline>

</seg2>

<seg2>

<tdline>kdjfkdjfhkj</tdline>

</seg2>

<seg2>

<tdline>kdjfkdjfhkj</tdline>

</seg2>

<seg2>

<tdline>kdjfkdjfhkj</tdline>

</seg2>

</seg1>

<seg1>

<tdname>urt</tdname>

<seg2>

<tdline>kdjfkdjfhkj</tdline>

</seg2>

<seg2>

<tdline>kdjfkdjfhkj</tdline>

</seg2>

<seg2>

<tdline>kdjfkdjfhkj</tdline>

</seg2>

<seg2>

<tdline>kdjfkdjfhkj</tdline>

</seg2>

</seg1>

<seg1>

<tdname>xyz</tdname>

<seg2>

<tdline>kdjfkdjfhkj</tdline>

</seg2>

<seg2>

<tdline>kdjfkdjfhkj</tdline>

</seg2>

<seg2>

<tdline>kdjfkdjfhkj</tdline>

</seg2>

<seg2>

<tdline>kdjfkdjfhkj</tdline>

</seg2>

</seg1>

</root>

target shoud like this.

<root>

<seg1>

<tdname>abc</tdname>

<seg2>

<tdline>kdjfkdjfhkjdfhdjkfhkdfjhgfj</tdline>

</seg2>

</seg1>

<seg1>

<tdname>xyz</tdname>

<seg2>

<tdline>kdjfkdjfhkjdfhdjkfhkdfjhgfj</tdline>

</seg2>

</seg1>

<seg1>

<tdname>urt</tdname>

<seg2>

<tdline>kdjfkdjfhkjdfhdjkfhkdfjhgfj</tdline>

</seg2>

</seg1>

<./root>

but iam getting

<seg1>

<tdname>abc</tdname>

<seg2>

<tdline>kdjfkdjfhkjdfhdjkfhkdfjhgfj

jghkjghkfjghkfj

fghkfjghjkf

fjghfjg</tdline>

</seg2>

</seg1>

what can idoo pls help me

iam writing one udf for this

but it is not working proparly

pls help me

with regards

srikanth vipparla

Edited by: srikanth vipparla on May 29, 2008 5:04 AM

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi,

When u write UDF at that time there are three options

1. Value

2. Context

3. Queue.

Select Context from that and do mapping as i mentioned earlier.

Regards,

Rohit

Reward points if helpful.

Former Member
0 Kudos

Hi srikanth,

do the below mapping:

root-->root

seg1-->seg1

no mapping needed for seg2, just make it 1...1 in the structure

tdname-->tdname

change the context of tdline to seg1, then do this mapping: tdline>concat(udf)>tdline

now the udf: create the udf as the Cache type Context

public void concat(String[] a,ResultList result,Container container){
   String res="";
   for(int i=0;i<a.length;i++)
       res+=a<i>;
   result.addValue(res);
}

let me know if you are still facing any problem.

--Sankar Choudhury

0 Kudos

Hi,

Follow the steps that Rohit has suggested.

For the UDF :

Use

Cache : Context

You can use the following UDF for your scenario,

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

where a is argument tdline from input message.

Former Member
0 Kudos

iam allredy doing this this thing but it is not working

it is concatinating all the segments

means all tdlines in the deffarent segemnts also.

you telling cacth context how to do that can u tyell me about that

with regards

srikanthvipparla

Former Member
0 Kudos

Srikanth,

When you are creating the udf after the udf name and description there is a cache type Value,Context,Queue. just select that to context.

but before using the udf in the mapping change the context of tdline to seg1.

--Sankar Choudhury

Former Member
0 Kudos

Srikanth

Slight change to the UDF given above, it shd be like this (braces are not right)

String res="";

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

{

res+=a<i>;

}

result.addValue(res);

While creating UDF, below the Description you will see 3 radio buttons called Value, Context and Queue. Choose the Context radiobutton and in the arguments pass,

Argument - a

Result - result.

Also ensure that you right click on tdline and set the context to seg1.

Sameer

Former Member
0 Kudos

Hi,

try this,

Seg1>RemoveContext>Seg1

Seg1>SplitByValue(EachValue)>Seg2

tdline(Put context on Seg1)>UDF(To concat data which u written)>tdline.

Regards,

Rohit

Reward points if helpful.

Former Member
0 Kudos

Hi Srikanth,

If you have IDOC Structure Like bellow,

<Root> 1-1 occurrence

<Seg1> 0-Unbounded

<TDName> 1-1

<Seg2> 0-Unbounded

<TDLine> 0-Unbounded

Then

You Must create a File structure Like bellow,

<Root> 1-1 occurrence

<Seg1> 0-Unbounded

<TDName> 1-1

<Seg2> 0-1

<TDLine> 1-1

Do the Mapping ,

TDNameRemove ContextexitsSplitbyValue(ValueChange)-Createif--Seg1

TDNameRemove ContextSplitbyValue(ValueChange)---TDName

TDNameRemove ContextexitsSplitbyValue(Each Value)-Createif--Seg2

TDlineRemove Context(UDF for concatinate Multiple TDLine)--TDLine

*Reward Points If Helpful*

Regards,

Prakasu

Former Member
0 Kudos

context for <tdline> shud be <seg1> so that u need not use remove context and in the UDF use context instead of Queue