cancel
Showing results for 
Search instead for 
Did you mean: 

Conditional mapping in Graphical mapping

Former Member
0 Kudos

Hi All,

I have a conditional mapping requirement i.e.I have 2 nodes ( collections/collection/object and extensions/collection/@name) in the source structres. Both nodes are identical and have unbound occurences. Based on certain condtions I need to map second node in the source node to target node ( Items ). Below is the condition.

If first node '/MT_FCI_CONTRACT_EXPORT/fcidataexport/objects/object/collections/collection/object/@classname' (Occurs Unbounded ) value is not 'contracts.LineItem' and second node '/MT_FCI_CONTRACT_EXPORT/fcidataexport/objects/object/extensions/collection/@name' ( Occurs Unbounded ) value is 'MATGRP_COLLN' then only map source field '/MT_FCI_CONTRACT_EXPORT/fcidataexport/objects/object/extensions/collection/row' ( occurs unbounded ) to target node 'Items' ( Occurs unbounded ).

I have done this mapping using If condtions and did some context changes. My second condition is working fine but my first condition is not working as expected. Its only taking value in the first occurences and based on that passing first condition. But I need to check in all occurences whether value 'contracts.LineItem' is not exist then only I need to pass that condition. Please let me know how to achieve this.

Please help me to achieve my requirement.Thanks.

Regards,

Rajesh

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Rajesh,

To reply your query first we have to understand the exact requirement . So I am writing my understanding below and solution for it .Kindly reply if your requirement is different.

you have three source field which is involved in mapping .@classname, @name, and row and target side you have node item .

Now you have to check for all classname and name that if classname is not equal to contracts.LineItem and @name is equal to MATGRP_COLLN ( both the values I have considered as constant) then map row to target node item. i.e if classname and lineitem is occuring 4 time and two time both are satisfying both the codition then generate two target Item node .

Solution.

classname -> (CollapseContext)->equals to ContractLineitem --not -->

AND -


IIF WITHOUT ELSE

Name -


>(CollapseContext)-->equals to MATGRP_COLLN--


>

the condition of if without else function will be output of AND and in then map row----.(collpasecontext) finally the output of if without else will be mapped to item

note :all ittalic is Graphical mapping functions .

Regards,

Saurabh

prasannakrishna_mynam
Contributor
0 Kudos

Hello Rajesh,

If first node '/MT_FCI_CONTRACT_EXPORT/fcidataexport/objects/object/collections/collection/object/@classname' (Occurs Unbounded ) value is not 'contracts.LineItem' and 
second node '/MT_FCI_CONTRACT_EXPORT/fcidataexport/objects/object/extensions/collection/@name' ( Occurs Unbounded ) value is 'MATGRP_COLLN' then only map source 
field '/MT_FCI_CONTRACT_EXPORT/fcidataexport/objects/object/extensions/collection/row' ( occurs unbounded ) to target node 'Items' ( Occurs unbounded ).

In order to achive this

@classname   <not> <Equals> @contracts.LineItem                                                                                
<AND>   IFwithoutELSE < @row> Then  ->  <@items>
@name <Equals> 'MATGRP_COLLN'

Here @classname <not> <Equals> - True and @name <Equals> - True then only the @row source will be mapped to the target node.

Regards,

Prasanna

Former Member
0 Kudos

I have done this mapping using If condtions and did some context changes. My second condition is working fine but my first condition is not working as expected. Its only taking value in the first occurences and based on that passing first condition. But I need to check in all occurences whether value 'contracts.LineItem' is not exist then only I need to pass that condition. Please let me know how to achieve this.

Hi ,

In your same mapping try to use the Node Function USE ONE AS MANY with the parameters as below:

Parameter1:

'/MT_FCI_CONTRACT_EXPORT/fcidataexport/objects/object/collections/collection/object/@classname'

Parameter2:

'/MT_FCI_CONTRACT_EXPORT/fcidataexport/objects/object/extensions

Parameter3:

'/MT_FCI_CONTRACT_EXPORT/fcidataexport/objects/object/extensions/collection

Use the same mapping as u have done before jus add this USEASMANY in your IF condition. This fuction will generate an occurance for first condition same as that of your second condition.

Regards,

Rahul

former_member200962
Active Contributor
0 Kudos
If first node '/MT_FCI_CONTRACT_EXPORT/fcidataexport/objects/object/collections/collection/object/@classname' 
(Occurs Unbounded ) value is not 'contracts.LineItem' and second 
node '/MT_FCI_CONTRACT_EXPORT/fcidataexport/objects/object/extensions/collection/@name' ( Occurs Unbounded ) value 
is 'MATGRP_COLLN' then only map source 
field '/MT_FCI_CONTRACT_EXPORT/fcidataexport/objects/object/extensions/collection/row' ( occurs unbounded ) to target 
node 'Items' ( Occurs unbounded ). 

Have your mapping logic as below......Right click on classname & name attributes and increase there Context to a node which is at some higher level:

@classname---->
                                    --->equalS --->Not-->
Constant(contracts.LineItem)-->
                                                        --------->And ---> IfWithoutElse(Then --> row) ------> Item
@name-->
                                     --->equalS -->
Constant(MATGRP_COLLN)-->

Regards,

Abhishek.