on 11-08-2011 6:56 PM
Hi,
My sender structure is as follows
<zaction>(1:1)
--Trans
<Zcode>(0:999)
--Code
--Id
My target field is
<code>(0:999)
--ID
My requirement is
if code= CE,CB,CH,CJ,CI,CO then don't create target field ID.
else
if code=AF and Trans=01 then ID=axv0001
or
if code=AF and Trans=02 then ID=axv0002
if none of the above conditions matches pass ID received from sender.
I am confused at using context type UDF. As suppress result is completely supressing the target field. it's not looking into the rest of logic. Can you provide me an appropraite UDF for this logic please.
TIA,
Mahesh
Hello,
You can use this context type UDF:
Arguments: inTrans
inCode
inID
for(int a=0;a<inCode.length;a++){
if(inCode[a].equals("CE")|inCode[a].equals("CB")|inCode[a].equals("CH")|inCode[a].equals("CJ")|inCode[a].equals("CI")|inCode[a].equals("CO")){
result.addSuppress();
}
else if(inCode[a].equals("AF")&inTrans[0].equals("01")){
result.addValue("axv0001");
}
else if(inCode[a].equals("AF")&inTrans[0].equals("02")){
result.addValue("axv0002");
}
else{
result.addValue(inID[a]);
}
}
Logic is like this:
For code
Trans -> removeContext -> \
Code --> removeContext -> UDF -> code
ID ----> removeContext -> /
For ID
Trans -> removeContext -> \
Code --> removeContext -> UDF -> splitByValue:eachValue -> ID
ID -----> removeContext -> /
Hope this helps,
Mark
Edited by: Mark Dihiansan on Nov 9, 2011 3:47 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Raj is right, you need to use mapWithDefault
Trans -> removeContext ----------------------------------> \
Code --> removeContext ----------------------------------> UDF -> splitByValue:eachValue -> ID
ID ----->mapWithDefault:Suppressed------> removeContext -> /
You just need a little tweaking from the UDF to control the output
Arguments: inTrans
inCode
inID
for(int a=0;a<inCode.length;a++){
if(inCode[a].equals("CE")|inCode[a].equals("CB")|inCode[a].equals("CH")|inCode[a].equals("CJ")|inCode[a].equals("CI")|inCode[a].equals("CO")){
result.addSuppress();
}
else if(inCode[a].equals("AF")&inTrans[0].equals("01")){
result.addValue("axv0001");
}
else if(inCode[a].equals("AF")&inTrans[0].equals("02")){
result.addValue("axv0002");
}
else{
if(inID[a].equals("Suppressed")){
result.addSuppress();
}
else{
result.addValue(inID[a]);
}
}
}
Hope this helps,
Mark
as i can see, you can solve you requirement ussing a UDF but also ussing standard functions.
for example you know the rigths codes. so you can do this:
change the context of <Code> to the nameof your message Type > rigth click> context-->MT_XXX
once you did it use the Equals function (Text group) and compear with 'AF':
<Code>---------------Equals---->And----->Trans-->Equals-------IF(true)---->axv0001
AF(constant)--------- 01------> (false)---> Trans-->Equals--->ifWithOutElse-->axv0002
02---->
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
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.