cancel
Showing results for 
Search instead for 
Did you mean: 

N:M Mapping

Former Member
0 Kudos

hi,

i have SourceStructure with occurrence n; and TargetStructure with occurrence m;

for each occurrence of SourceStructure i want to repeat the target structure(with mapping logic associated with it).

FYI.  I already have 1-1 mapping with same source and same target with mapping logic with it.

now its N:M (or you can say N:N; as the source and target occurrence are same)

help is appreciated.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

thanks all..

as of now i did one to one feild mapping, i'm fine until this point.  will have to introduce one more mapping after this to handle logic required which is complicated..

Answers (3)

Answers (3)

iaki_vila
Active Contributor
0 Kudos

Hi Prema, as Ankit says we need more information in order to help you.

At first i suppose that you are using the graphical mapping only.

Right now im going to suppose, you could have an xml source like this:

<SourceStructure>

<a>1</a>

<b>2</b>

</SourceStructure>

You have a graphical mapping with some logic inside, for example using a concatenate function:

<TargetStructure>

<c>12</c>

</TargetStructure>

Now you have the next requiriment:

<NewRoot>

<SourceStructure>

<a>1</a>

<b>2</b>

</SourceStructure>

<SourceStructure>

<a>3</a>

<b>4</b>

</SourceStructure>

</NewRoot>

And you desire one output like this:

<NewRoot>

<TargetStructure>

<c>12</c>

</TargetStructure>

<TargetStructure>

<c>23</c>

</TargetStructure>

</NewRoot>

 

All this in one operation mapping with cardinality 1:1

With these suppositions the first answer of Ankit Soni should work, you only need to link SourceStructure to TargetStructure with the cardinality changed to unbound. 

I suppose the problem is more complicated than this, please correct my supositions and if you want, you could give an XML example

Regards

Former Member
0 Kudos

thank you all for your answers.. here are my structures and is complicated mapping.. now for each occurence of  source PaymentData_Filter  i want  to have MRI_PaymentData created with mapping logic whatever it has..  it actually groups and calcualates the building toal cost n everything

Former Member
0 Kudos

hi Prema,

You have shown logic for some other node. What mapping logic you are applying to your node MRI_PaymentData ? What behavior are you getting currently for that node?

former_member184681
Active Contributor
0 Kudos

Hi,

Did you map the following (literally, node to node, not only field to field)?

Messages -> Messages
Message1 -> Message1
PaymentData_Filter -> MRI_PaymentData

I believe this could be what you are missing here and what would solve your problem.

Hope this helps,
Greg

Former Member
0 Kudos

thanks greg; my problem is not able to handle the context values within EACH node..

former_member184681
Active Contributor
0 Kudos

Well, it's hard to say without the insight into the mapping, but maybe what you also need to do is set the context of the source fields to the root, and then put the splitByValue(Each Value) for each mapped target field, just before it (so after all the "normal" mapping you do). Let me know the results.

Hope this helps,
Greg

Former Member
0 Kudos

actually it is one of the field mapping;

for EACH PaymentData_Filter  i have to create one MRI_PaymentData mapping will consolidate all records for perticular building-ID.. .. buidling -ID can be multple in one PaymentData_Filter based on that it creates so many subnodes in MRI_PaymentData.

example

if i have 4 PaymentData_Filter

------------- 1. PaymentData_Filter
<11>
<12>
<13>
<14>
------------- 2. PaymentData_Filter
<21>
<22>
------------- 3. PaymentData_Filter
<31>
<32>
<33>
-------------- 4. PaymentData_Filter
<41>

if i have 2 building-IDs(assuming two repeates in another two nodes) in  1. PaymentData_Filter  then in my MRI_payment it should create 2 subnodes.. so basically i want to handle that context values .. and apply the logic..

iaki_vila
Active Contributor
0 Kudos

HI Prema,

If i understand well ( if i wrong please ignore this message ), right now with :

------------- 1. PaymentData_Filter

<11> with their building-ID

<12> with their building-ID

<13> with their building-ID

<14> with their building-ID

You are generating four MRI_PaymentData, but now you have various PaymentData_Filter.

As far i've seen in your image you are using the SplitByValue(each_value) function on the subnodes.

I think it's better to try the divide and conquer aproximation and try something easy. With

------------- 1. PaymentData_Filter

<11> with their building-ID

<12> with their building-ID

<13> with their building-ID

<14> with their building-ID

------------- 2. PaymentData_Filter

<21> with their building-ID

<22> with their building-ID

How many MRI_PaymentData tags have you got?. The first is to obtain the six MRI_PaymentData nodes.

1. The build-ID, esential to do the deccision, belongs to HeaderRecord, Payment or overflowdetail?

2. Could be the build-ID be repeated?, could be ordered every PaymentData_filter with the building-id?

     If the answer is yes you could use SplitByValue(Value_Changed) in order to generate PaymentData_Filter

3. Is it possible that differents PaymentData_Filter have the same building-id and you want to mix them?, if the answer is yes is very complicated to deal with a graphical mapping, at least for me

Regards.

iaki_vila
Active Contributor
0 Kudos
Former Member
0 Kudos

Inaki; i did that already. thanks.  I'm using PI 7.11

Former Member
0 Kudos

Hi Prema,

If you are using data types, you can change the occurence of the source & target nodes to 0..unbound for it. If you are xsd, modify the XSD to change occurence.

Former Member
0 Kudos

Ankit; i have changed the occurrence.. I'm fine with that. now my question is i want to repeat the target structure with each occurrence of source structure. 

Former Member
0 Kudos

You can map it to source directly if you don't have any mapping logic. Target will be created the same number of times as source field comes.

Former Member
0 Kudos

ankit, i do have mapping logic inside.

Former Member
0 Kudos

Hi Prema,

Sorry, I did not get what problem you are facing. Are you having some issue with mapping logic ? Could you please elaborate more for better response from community ?