on 05-29-2008 4:04 AM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
context for <tdline> shud be <seg1> so that u need not use remove context and in the UDF use context instead of Queue
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.