on 02-04-2009 4:07 PM
Hi All,
Can anyone please help me to check the values in the context.
I have four context changes coming from the source and have to check the values in the context. If any value from in the context is Y then the output has Y else X.
INPUT:
X
contextchange
X
X
contextchange
X
X
Y
contextchange
X
Y
Y
X
contextchange
Output:
X
contextchange
X
contextchange
Y
contextchange
Y
contextchange.
Cheers,
Smith.
Hi,
This can be done without using UDF, this is assuming that you only have two inputs (X and Y)
You can use the mapping below:
input --> sort: lexicographical (case insensitive) descending --> collapseContexts --> splitByValue --> target node
explanation: the sort function, sorts each letter per context in lexicographical order. The output is that if there is a Y, it will always be placed in the first position of the context. Then you collapse the context so that the duplicates/excess entries are removed (only the first value is retained). Then the splitByValue does the splitting.
Hope this helps,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try the following UDF,
Use UDF Execution Type = Context.
int cnt = 0;
for(int i = 0;i<inputValue.length;i++)
{
if(inputValue<i>.equals("Y"))
{
cnt++;
}
}
if(cnt > 0)
{
result.addValue("Y");
}
else
{
result.addValue("X");
}
-Rohit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
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.