on 08-16-2013 3:46 PM
I'm a SAP CRM developer new to PI. This might be a simple question, I tried to find this in forums but couldn't find it.
Question:
I have a source node with 0 to N occurrences and target node with 1 occurrence.
Target fields are mapped to same source field but with different mapping rules. See the screen shot below.
If the source has values A and Z , my target should give same values. but here my target is always taking first occurrence and giving values A and 0.
What should I do to get the target as A and Z. i.e. read each occurrence of source node.
Thanks in advance.
Hi,
Please try this.
Context of src_fld1 should be test_source_msg.
right click on the node and traverse to context and choose test_source_msg.
Same for other field
And it should work....
Hope it answers your question
Ambrish
PS: this is assuming A and Z will come just once in the source nodes....
Message was edited by: Ambrish Mishra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
PI graphical mapping is based on queues and contexts (grey portion between values).
Your requirement is to create the target node only once.
Earlier when the queue was set to context to node1, there was a context change with value in each context so it means both the queues will try to execute node1 number of times (twice in your test case). When you set it to higher context (message type level), both the values come under same queue and will execute once. If without else in case, returns true gives corresponding source value(s) which get populated into the same target field. In case it returns false so an suppress (it is not a null but a empty context) is created which is handled by mapWithDefault which introduces a zero when it sees a suppress....
Hope I was able to explain it.
Ambrish
PS: there are multiple tutorials on SCN on this concept.
Hi,
did you try to debug the message mapping using display queue?
you may get some clue why you are getting 0 for z.
Regards,
Muniyappan.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
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(var2[0].equals(var1[i]))
{
result.addValue(var1[i]);
count=count+1;
break;
}
}
if(count==0)
result.addValue(0);
Mapping:
src_fld1 ->
---------------->UDF ----tg_fld1
Constant(A)
src_fld1 ->
---------------->UDF ----tg_fld2
Constant(Z)
Note - do remember to change the context of "src_fld1" field and set it to MT name.
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.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.