on 07-15-2013 2:12 PM
Hi All,
I had a mapping rule where I have to pull specific filed's form source in each context and add them to the target.
for example form the below diagram from the source has two contexts have to pull out 4th field in both contexts.
target field values would be 4 and 9.
I tried standard function "CopyValue", but it returns value from first context. i.e value 4.
Can I complete this task using standard functions or can do I have to use UDF?
If I have to use a UDF please provide me java code for the same.
Regards,
Pradeep A.
Hi All,
Thanks.. hear is the final udf which executed successfully as per my requirement.
public void getValueFromEachNode(String[] input, String[] loc1, ResultList result, Container container) throws StreamTransformationException{
int loc = Integer.parseInt(loc1[0]);
result.addValue(input[loc-1]);
for(int i=5;i<input.length;i++)
{
if(input[i]==ResultList.CC)
{
result.addValue(input[i+loc]);
i=i+5;
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pradeep,
I don't think you need to run a loop since you just need to pass on a value at a particular index.
Any ways..
Ambrish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pradeep,
paramter name input
Code below:
_________________________________
if(input.length>3)
result.addValue(input[3]);
else
result.addValue("");
_________________________________
Ambrish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi pradeep,
you can go for udf
logic is like below there might be sytex problem plz do needful for that:
ResultList.addvalue(a[3]);
for(i=4;i<a.lenght;i++)
{
if(a[i]==Result.CC)
{
i=i+4;
ResultList.addvalue(a[i]);
}
}
Regards
Gagan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.