on 10-21-2011 1:26 PM
Hi
My logic is
if txt=os then pass UA
or
if txt=gs then pass TA
else
pass DEL
here txt comes in a segment which comes multiple times.let me say for example if an idoc is coming with 3 segments and txt=gs is in the last segment then output should be TA.
I wrote and udf(Value) using normal if else conditions but it's returning the value DEL as txt in first segment is someother value. But i need to consider all 3 segments and then return the output value. How to handle this contexts.please help me.
PS:Target field is 1:1 occurance
TIA
Hi,
>>>>let me say for example if an idoc is coming with 3 segments and txt=gs is in the last segment then output should be TA. But i need to consider all 3 segments and then return the output value...
Does it mean you've to consider the last occurrence of the segment...or you want to give any priority to any segment????
If you want to consider the last occurrence then set the UDF type as allValues of queue and consider the last value of the input array....Can you post sample input and expected result sothat I can provide you the UDF logic
Regards,
Priyanka
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Execution type: all values of context
txt-removecontext-target
int count=0;
for(int i=0;i<var1.length;i++)
{
if(var1<i>.equals("os"))
{
result.addValue("UA");
count =count+1;
}
if(var1<i>.equals("gs"))
{
result.addValue("TA");
count =count+1;
}
}
if(count==0)
{
result.addValue("del");
}
what if ur input queue will have both the values like os and gs..in that case how will u take ur output??
Hi,
Please use following code-
String val = (String) container.getTransformationParameters().get(StreamTransformationConstants.SENDER_SERVICE);
int index = val.length();
String sub = val.substring(index-2, index);
Integer lv_src = Integer.parseInt(src);
src = lv_src+"";
if (sub.equals("US"))
{
src= "US-" + src;
}
else if (sub.equals("SW"))
{
src= "SW-" + src;
}
else if (sub.equals("UG"))
{
src= "UGL-" + src;
}
return src;
Adjust it to suit your need and it should work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
can u please paste ur source and target structure??
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.