on 08-16-2013 4:46 PM
Hi,
I am trying to find a way to suppress context changes (SUPPRESS or <null>) in a mapping.
To understand, this is what I get in my context :
http://www.tu-peux-pas-test.com/upload/2013_08/pimappingcontext1.jpg
And here is what I want as a result (I modified the test data to get this) :
http://www.tu-peux-pas-test.com/upload/2013_08/pimappingcontext2.jpg
I tried many UDFs like this one but I can't have the result as expected.
http://www.tu-peux-pas-test.com/upload/2013_08/pimappingcontext3.jpg
The result of this kind of UDFs is that I have a <null> instead of SUPPRESS but still don't have the expected result :
http://www.tu-peux-pas-test.com/upload/2013_08/pimappingcontext4.jpg
As I have n values in different contexts, I can't use a simple "removeContext" and "splitByValue"...
I hope my request is quite clear and somebody can help.
Thank you,
Jeremy.
Hi,
Try this code with execution Type All values of queue
for(int i=1;i<a.length;i++)
{
if(a[i]!=ResultList.CC && a[i-1]==ResultList.CC)
result.addValue(a[i]);
else if(a[i]!=ResultList.CC && a[i-1]!=ResultList.CC)
result.addValue(a[i]);
else if(a[i]==ResultList.CC && a[i-1]!=ResultList.CC)
result.addValue(a[i]);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Jeremy,
It is a context change not suppress. Use
if(!a[i]equals(ResultList.CC)){
result.addValue(a[i]);
}
instead. As was suggested in the link above.
Regards,
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Adarsh,
Thank you for pointing this out. Here is the modified code
UDF Type: Queue Type
for(int i=0;i<a.length;i++){
if(i+1==a.length){
result.addValue(a[i]);
}
else{
if(!a[i].equals(ResultList.CC) & !a[i+1].equals(ResultList.CC)){
result.addValue(a[i]);
}
else if(!a[i].equals(ResultList.CC) & a[i+1].equals(ResultList.CC)){
result.addValue(a[i]);
result.addContextChange();
}
}
}
Test input
Hi,
The Suppress shown above is Grey colored one, not a Green one which can be removed by your code. This is most likely caused by the missing field on which you have applied the IfwithoutElse condition.Refer to the threads below:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jeremy,
Use a remove context to remove all the suppressed fields, then as suggested by Amit Srivastava, try to leverage use node function FormatByExample this should solve your purpose.
I had faced a similar problem in one of my interfaces with the use of FormatByExample, I was able to solve my purpose.
Regards,
Nipun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Since u have to find Context changes in ur input queue so u have to use "ResultList.CC", but still it won't impact ur output too much. IMO, u have to look out for “FormatbyExample” kind of function( or create a UDF which provide same kind of functionality)…
Check this UDF:
Input will be var1 and var2
Execution type: all values of a context
int count=0;
for(int i=0;i<var1.length;i++)
{
if(!var1[i].equals("0"))
{
for(int j=0+count;j<Integer.parseInt(var1[i])+count;j++)
{
result.addValue(var2[j]);
}
count=Integer.parseInt(var1[i])+count;
result.addContextChange();
}
}
Thanks
Amit Srivastava
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jeremy,
Instead of checking for suppress, please try !a[i].equals("") and do resultlist.addValue(a[i])
Hope it helps!
Ambrish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ambrish,
Thanks for your help, I tried but I got the same behavior as previous UDFs :
http://www.tu-peux-pas-test.com/upload/2013_08/pimappingcontext5.jpg
I also tried with this : ! a[i].equals("__cC_")) for the same result
User | Count |
---|---|
85 | |
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.