on 09-18-2012 9:22 PM
Hi Experts,
I'm a PI starter.I need your help in mapping.
I need to output the last value in a context.Kindly help me do this.
It has several contexts.I know we need a UDF to identify the last index in a context & output the value. If there is no way of doing this thorugh graphical mapping, please help me write a UDF.
Hi Harry,
Please check this wonderful article to understand more on context and queues
http://scn.sap.com/people/rohit.kalugade/blog/2008/12/08/context-and-queue-in-message-mapping-udf
you can solve these problems yourself.
Please rate the blog if you it useful.
Regards
Anupam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
U have to write a UDF for this:
Execution type: all values of a context
int a = var1.length;
result.addValue(var1[a-1]);
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 Amit,
The UDF I have provided would Suppress all values except the Last one since the Loop will run from 0 to n-1 values of the queue.
You can try the same. If we do ResultList.addValue("Any Value")
It will output only the first value of the Context.
I hope you got the point. I tried this in my Mapping today with a similar requirement.
Thanks
Tejas Bisen
Hi,
Indeed, it will work (i havent seen the condition for the last run) but do u really think that it's a good solution to have a for loop and suppressing each value except the last one...on the other side u can go directly and fetch the last value of a context without using any loop??
Thanks
Amit Srivastava
Hi Amit,
If the other values are not suppressed, only the first value of the context would be passed.
Also to correct my program a little ..instead of ResultList.addSuppress() it should be result.addSuppress(). Please have a look at the function i have implemented.
Here my condition is if null or no value comes I need to suppress or else allow a particular node to be created. If we don't loop and suppress other values in the context.
I think the only difference in your and my approach is I have using it at node level and then populating values under the node.
In the Function you provided, you are just passing the value that needs to go.
Your Function is also right Amit. I just tested it on my system
Thanks,
Tejas Bisen
User | Count |
---|---|
90 | |
10 | |
10 | |
9 | |
7 | |
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.