on 07-31-2008 9:07 AM
Hi experts,
I am facing the following problem :
i'm designing IDOC to JDBC scenario. On the source message of my mapping, I have the segment E1KNVVL of my idoc that contains the data TDLINE (the occurence of the segment is 0...9999). The problem is that I would like to concatenate all the TDLINE together if they exist.
Example :
I have one segment KNVVL that contains abc in TDLINE.
I have a second segment KNVVL that contains def in TDLINE.
I would like to have abcdef in my target message.
The problem is that def does not always exist or can exist several times.
I could not figure out the right conditions, I even tried java mapping but did not work.
Any help would be greatly appreciated,
Regards,
Jamal
Hi Jamal,
if you use graphical mapping.
Use a UDF, set the radiobutton context!
Name your importparameter TDLINE.
String returnString = "";
for (int i = 0; i < TDLINE.length; i++) {
returnString = returnString+ TDLINE<i>;
}
return returnString;
Regards Mario
Edited by: Mario Müller on Jul 31, 2008 4:25 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks so much, Mario UDF works perfectly fine.
I just had to add Result.addvalue at the end
Thanks a million for you help every one!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The problem is that def does not always exist or can exist several times.
--->
To handle this in UDF which Mario has suggested, just keep a if condition
String returnString = "";
if(TDLINE.length>0){
for (int i = 0; i < TDLINE.length; i++) {
returnString = returnString+ TDLINE<i>;
}
return returnString;
} // end if
else
return TDLINE[0];
While creating UDF use TDLINE as input parameter and Cache Queue
Edited by: Mugdha Kulkarni on Jul 31, 2008 11:16 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
use the below graphical mapping
TDLINE->remove context->add -
>targetmessage
KNVVL----
>
here add is the udf which has 2 inputs
1) TDLINE(use remove context node function after TDLINE)
2) KNVVL
add
use cache parameter context
public void add(String () a,String () b,ResultList result,Container container)
{
String c = " ";
for(int i=0;i<b.length;i++)
{
c = c + a(i) + " ";
}
result.addValue(c);
}
}
Edited by: malini balasubramaniam on Jul 31, 2008 11:14 AM
Edited by: malini balasubramaniam on Jul 31, 2008 11:18 AM
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 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.