on 06-08-2011 9:56 AM
Hello,
issue is about an external definition that gives this structure....
node1 (nilllable = true)
-> node2 (occurence 1..1)
-> field1 (occurence 1..1)
node3
-> field2
So the node2 and field1 under the nillable node1 are mandatory.
The message has to be used for a receiver.
The bad situation is, the incoming message from the sender looks identical for this segment including the nil definition
and has to be mapped 1:1 !!!!!
A test message from the sender looks like this for this message segment.....
....
<node1 nil="true"/>
<node3/>
<field2>value</field2>
....
So PI comes up with an error as it is not able to create the field (field1) under the second node (node2).
Using "exists" I can create the node2, but how to create the field1 with graphical mapping?
Your help is really appreciated!
Best regards
Dirk
Hi Dirk
Since those nodes have 1:1 occurrence, you have to create them with map with default, or mapping will fail.
If target system wants an empty node1 when the nil attribute is true, then the external definition should be changed so that node2 and field1 are optional.
Regards,
Giuseppe
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If source reference field -> "isNil
source field -> map with Default
else
source field -> map with Default
Unbelievable and simple but it works!
For "else" the mapping provides the value of the element, for "if" it will create the target field with [] value.
If "nilable" is provided with a main node with a segment inlcuding element
for the element the mapping requires the context reference to the main node.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
A nil value can only apply for elements, not for nodes (complex types)
So your XML definition is not correct according to the XML specification.
Ask for a correct XML specification.
See details here:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
maybe I am not clear enough.
The field is an element of the second node not of the first node.
node1 -> node 2 -> field1
So it is no issue to create node e.g. with "exists" function, but the field in sub level 2 cannot be created.
I tried to use isNil function (SAP PI 7.11) but this one seems to have an issue as I expect to have a result "true" for this situation as examples show "false" if the node1 is not nil= true.
But this one gives back "null" and so I cannot create any sub element.
Best regards
Dirk
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tushar,
Sorry, this is not really clear to me...
Try to describe the mapping: IF/THEN/ELSE/result are the connectors of the If function.
Node2 -> EXIST -> IF
Node2 -> THEN
Node1 -> ELSE
So these are the input param for the IF function
result -> NODE2
So where to place the createIf function
Best regards
Dirk
I suppose createIf is not required.
If Node2 Exists
Then Graphically Map Node2(S) to Node2(T)
Else
Graphically Map Node1(S) to Node2(T)
This will take care for creating the Node2 at target even if the source does not have the Node2 element but has Node1. You need to carefully handle the context.
Once the field's parent element is created, you can easily map the Field1. In order to take care of the non-occurence of
Field1(S), please use mapWithDefault.
Thanks
Tushar
Edited by: Tushar Saurabh on Jun 8, 2011 2:02 PM
map source field with mapWithDefault function to field1.
Regards
Pothana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dirk,
Nillable specifies whether an explicit null value can be assigned to the element. It does not mean the mandatory child elements and fields will not occur. As per you example the child elements and fields are mandatory and they are missing while forming the target structure.
Is the external definition for source or target?
Thanks
Tushar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.