on 10-19-2009 5:00 AM
I am using IDOC to File scenario. I have to concatenate Item Item Text(s) into 1 field as concatenated.
Line Item Text-ID can be in E1EDPT1 and text can be present in E1EDPT2 ( 1 or more depending upon the length of text).
Now I can do this using graphical mapping but once there are more than 1 E1EDPT2 present for same line Item it does not always work correctly, Therefore I am thinking of deploying UDF.
Do you guys have any ideas ? I am not a Java Developer...
Cheers,
use removeContext after ifWithoutelse and before UDF
as
text(change the Context to E1EDPT1) ----------->then
TDID----------->equalS--------------------------->IfWithoutElse------->removeContext---->UDF----->targetField
constant[FO4]/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just had to revisit the same thread for better understanding of the problem...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can I please ask you to explain the effect of 'Remove Context' after 'Ifwithoutelse' , which made the difference ?
when the value of TDID is not equal to F04 the equalS standard function returns false to ifWithoutElse standard function.when the input to ifWithoutElse is false ,the corresponding values of text are getting suppressed.output of ifWithoutElse then contain
some context with only suppress value and in other context having corresponding text value for which the condition is satisfied.
When the input to the UDF is the suppress value it is not entering into the forloop and returning blank value(what is initialised for concatText variable).When you use removeContext before passing the values to UDF then it creates only one context having text values and removing the suppress values.
(Excuse me for very long explaination)
Thanks and regards,
Kubra fatima
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I am having a slight problem with this mapping. If there are Item Text(E1EDPT1/T2) in one or more Line Items (E1EDP01) it is concateing them all once. where eas I want it to be concatenated on Item Level
E1EDP01 (Item1)
+-E1EDPT1
+--E1EDPT2( text line1 for Item 1)
+--E1EDPT2(text line2 for Item 1))
E1EDP01(Item2)
+-E1EDPT1
+--E1EDPT2 (text line1 for Item 2)
+--E1EDPT2 (text line2 for Item 2)
At the moment all the 4 lines are concatenated in one variable , where as I want them to be concatenated on line item level.
then Do the mapping as
text(change the Context to E1EDPT1) ----------->then
TDID----------->equalS--------------------------->IfWithoutElse----->UDF----->targetField
constant[FO4]/
change the context of text to E1EDPT1 by right clicking on text and selecting E1EDPT1.Now dont Use removeContext standard function.No need to change the context of TDID.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I changed the mappings ,
Now I get the blank in target field.
By doing display queue , I can see 2 'suppressed' lines out of 'Ifwithoutelse' + 5 lines of F04 then when they get into UDF ,what comesout is 2 blank lines and 2 lines of F04 ( all concatenated, which is good ) , but I dont know how to get rid of the top blank lines which is populating the target field....
How is the structure of source message?
Is it like this
E1EDPT1 .......0..Unbounded
TDID
EIDEDPT2----0...Unbounded
TEXT
or
E1EDPT1 .......0..Unbounded
TDID
EIDEDPT2----0...Unbounded
TEXT
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try like this
text( present in E1EDPT2) ------>removeContext----->then
TDID----------->equalS--------------------------->IfWithoutElse----->UDF----->targetField
constant[FO4]/
without changing the UDF.
if E1EDPT1 occurs multiple times then try changing the contex of TDID .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kubra,
I did the changes as you said. Since there are multiple line of E1EDPT1 for different TDID such as BEST / F04.
It somehow is picking up last line of BEST along with lines for F04.. I tried changing context of TDID to E1EDP01 - still the same...
Can I add the If condition in UDF ?
Thanks again.
use this UDF(choose context. a is one argument to this UDF)
String concatText="";
for(int i=0;i<a.length;i++)
{
concatText = concatText + " " + a<i>;
}
result.addValue(concatText);
In the above UDF I have concatenated the text with sapce between the Text.
if you dont want just change this line
concatText = concatText + " " + a<i>;
to
concatText = concatText + a<i>;
Do the mapping as
text( present in E1EDPT2) ------>removeContext------>UDF------>TargetField
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Kubra.
Now, I need to add one more condition " if Text ID = 'F04'" and that is in TDID in E1EDPT1, so I will pass this as another argument'b' to UDF , Right ?
Do I need to do any Context change for TDID before passing to UDF ?
I am making UDF like this , seems to be incorrect ,
//write your code here
String concatText="";
if(b[j].equals("F04")){
for(int i=0;i<a.length;i++)
{
concatText = concatText + " " + a<i>;
}
result.addValue(concatText);
}
Thanks for your help..
Edited by: Vaibhav Bhandari on Oct 19, 2009 6:43 PM
Edited by: Vaibhav Bhandari on Oct 19, 2009 6:45 PM
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.