cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping problem.

Former Member
0 Kudos

I have a problem with getting the mapping rigth.

I have the following source message:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:rtptest xmlns:ns0="http://">
   <messNo>123</messNo>
   <P01>
      <radNo>1</radNo>
      <P05>
         <P05data>11</P05data>
      </P05>
      <PXX>
         <PXXdata>111</PXXdata>
      </PXX>
   </P01>
   <P01>
      <radNo>2</radNo>
      <PXX>
         <PXXdata>222</PXXdata>
      </PXX>
   </P01>
   <P01>
      <radNo>3</radNo>
      <P05>
         <P05data>33</P05data>
      </P05>
      <PXX>
         <PXXdata>333</PXXdata>
      </PXX>
   </P01>
</ns0:rtptest>

The result should lokk in this way:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:rtptest xmlns:ns0"http://">
   <messNo>123</messNo>
   <P01>
   <radNo>1</radNo>
      <PXX>
      <PXXdata>111</PXXdata>
      </PXX>
   </P01>
   <P01>
   <radNo>2</radNo>
      <PXX>
      <PXXdata>222</PXXdata>
      </PXX>
   </P01>
   <P01>
   <radNo>3</radNo>
      <PXX>
      <PXXdata>333</PXXdata>
      </PXX>
   </P01>
   <P01>
   <radNo>1</radNo>
      <P05>
      <P05data>11</P05data>
      </P05>
   </P01>
   <P01>
   <radNo>3</radNo>
      <P05>
      <P05data>33</P05data>
      </P05>
   </P01>
</ns0:rtptest>

But we get the following result:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:rtptestxmlns:ns0="http://">
<messNo>123</messNo>
   <P01>
   <radNo>1</radNo>
      <PXX>
      <PXXdata>111</PXXdata>
      </PXX>
   </P01>
   <P01>
   <radNo>2</radNo>
      <PXX>
      <PXXdata>222</PXXdata>
      </PXX>
   </P01>
   <P01>
   <radNo>3</radNo>
      <PXX>
      <PXXdata>333</PXXdata>
      </PXX>
   </P01>
   <P01>
   <radNo>1</radNo>
      <P05>
      <P05data>11</P05data>
      </P05>
   </P01>
   <P01>
   <radNo>2</radNo>
   </P01>
   <P01>
   <radNo>3</radNo>
      <P05>
      <P05data>33</P05data>
      </P05>
   </P01>
</ns0:rtptest>

Ass you sse we get an extra P01 with <radNo>2</radNo> in it.

Thatone should not come. When we get this result we have P01 from the source mapped to P01 in the target.

I've tried to use P05 with the context set to rtptest to push the P01 but then we get the following result.

<?xml version="1.0" encoding="UTF-8"?>

<ns0:rtptest xmlns:ns0="http://">
<messNo>123</messNo>
   <P01>
   <radNo>1</radNo>
      <PXX>
      <PXXdata>111</PXXdata>
      </PXX>
   </P01>
   <P01>
   <radNo>2</radNo>
      <PXX>
      <PXXdata>222</PXXdata>
      </PXX>
   </P01>
   <P01>
   <radNo>3</radNo>
      <PXX>
      <PXXdata>333</PXXdata>
      </PXX>
   </P01>
   <P01>
   <radNo>1</radNo>
      <P05>
      <P05data>11</P05data>
      </P05>
   </P01>
   <P01>
   <radNo>2</radNo>
   </P01>
</ns0:rtptest>

We are still getting the P01 with <radNo>2</radNo> but not the last one.

I want the P01 with <radNo>2</radNo> to not be pushed and the last P01 to be ther when I have data in P05.

Does anybody know how I can solve this?

BR

Kalle

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Kalle,

I hope i've understood your requirement correctly. As per what i've made out of it, you could map the second P01 node as follows:

Use an "if-without-else" function. Change its property to "true".

Now take source side P05data (change its context to P01), a Constant = blank and put them on an EqualsS function. Add a boolean Not after EqualsS and put this on the IF part.

For the Then part put P01 with no context change.

Hope this works out for you.

Do reward points if the solution is helpful.

Regards,

Lavita.

Former Member
0 Kudos

Sorry get errormessage with that configuration.

Former Member
0 Kudos

Hi,

It would be helpful if you post in the error here.. Could try solving it perhaps.

Regards,

Lavita.

Former Member
0 Kudos

Missconfiguration of me used equales instead of equaless.

But when I do your config then I don't get the second P01 at all.

Tried with true and false as propertie in the if without else.

Former Member
0 Kudos

Yes,

You need to use EqualsS from the TEXT functions.

Is the context changed? Try adding Split by value after the if-without-else.

Do let me know if it works

Regards,

Lavita

Former Member
0 Kudos

Same result.

Former Member
0 Kudos

Change the context of P05data to mesNo.

See if it works.

Regards,

Lavita

Former Member
0 Kudos

Changed the context for P05 to rtptest. Got the same result.

mesNo are a field.

Former Member
0 Kudos

Change it to P01.

Think that should work.

Regards,

Lavita

Former Member
0 Kudos

That gives the same result.

Former Member
0 Kudos

Hi,

I did the mapping with your given structures and this is how it should be mapped.

Source Structure and Target Structures are:

rtptest

--> mesNo

--> P01

-


> radNo

-


> P05

-


> P05data

-


> PXX

-


> PXXdata

Now while you map them,

on the target side, duplicate P01 node and map as follows:

For the first P01 node, you map it using the IF-without-ELSE node.

Now take source side PXXdata (change its context to MT), a Constant with no value and put them on an EqualsS function. Add a boolean Not after EqualsS and put this on the IF part.

For the Then part put PXX (change its context to MT).

For the second P01 node, you map it using the IF-without-ELSE node.

Now take source side P05data (change its context to MT), a Constant with no value and put them on an EqualsS function. Add a boolean Not after EqualsS and put this on the IF part.

For the Then part put P05 (change its context to MT).

Map the rest of the functions as they are i.e. 1:1 mapping of radNo, etc

Regards,

Lavita.

P.S. Do reward points if the solution works for you.

Former Member
0 Kudos

Hi.

I just tried your config with this message.

<?xml version="1.0" encoding="UTF-8"?>

<ns0:rtptest xmlns:ns0="http://">
   <messNo>123</messNo>
   <P01>
      <radNo>1</radNo>
      <P05>
         <P05data>11</P05data>
      </P05>
      <PXX>
         <PXXdata>111</PXXdata>
      </PXX>
   </P01>
   <P01>
      <radNo>2</radNo>
      <PXX>
         <PXXdata>222</PXXdata>
      </PXX>
   </P01>
   <P01>
      <radNo>3</radNo>
      <P05>
         <P05data>33</P05data>
      </P05>
      <PXX>
         <PXXdata>333</PXXdata>
      </PXX>
   </P01>
</ns0:rtptest>

The result I get are

<?xml version="1.0" encoding="UTF-8"?>
<ns0:rtptest xmlns:ns0="http://">
   <messNo>123</messNo>
   <P01>
   <radNo>1</radNo>
      <PXX>
      <PXXdata>111</PXXdata>
      </PXX>
   </P01>
   <P01>
   <radNo>2</radNo>
      <PXX>
      <PXXdata>222</PXXdata>
      </PXX>
   </P01>
   <P01>
   <radNo>3</radNo>
      <PXX>
      <PXXdata>333</PXXdata>
      </PXX>
   </P01>
   <P01>
   <radNo>1</radNo>
      <P05>
      <P05data>11</P05data>
      </P05>
   </P01>
   <P01>
   <radNo>2</radNo>
   </P01>
</ns0:rtptest>

The result I want are

<?xml version="1.0" encoding="UTF-8"?>
<ns0:rtptest xmlns:ns0="http://">
   <messNo>123</messNo>
   <P01>
   <radNo>1</radNo>
      <PXX>
      <PXXdata>111</PXXdata>
      </PXX>
   </P01>
   <P01>
   <radNo>2</radNo>
      <PXX>
      <PXXdata>222</PXXdata>
      </PXX>
   </P01>
   <P01>
   <radNo>3</radNo>
      <PXX>
      <PXXdata>333</PXXdata>
      </PXX>
   </P01>
   <P01>
   <radNo>1</radNo>
      <P05>
      <P05data>11</P05data>
      </P05>
   </P01>
   <P01>
   <radNo>3</radNo>
      <P05>
      <P05data>33</P05data>
      </P05>
   </P01>
</ns0:rtptest>

Do you have any idea on how to get this result?

BR

Kalle

Former Member
0 Kudos

Hi...

You can do one thing... Use duplicate subtree in the target message... so you will be able to map PO5 and PXXData fields.

Also use "createif" function for radNo with a check that if PO5/PXX (to whichever subtree u are referring) exists create radNo node.

Former Member
0 Kudos

Trying to understand how the creatif works.

Looking at [http://help.sap.com/saphelp_nw70/helpdata/EN/d9/3033f96c79674f90e3ab8d101a595b/frameset.htm|http://help.sap.com/saphelp_nw70/helpdata/EN/d9/3033f96c79674f90e3ab8d101a595b/frameset.htm]

Do not understand how to make the test with createif.

If that function works as I think it do then that could be the solution.

Can you please make an example on how to use it in the configuration and how to connect it?

Former Member
0 Kudos

Hi,

This is the input


   <mesNo/>
   <P01>
      <radNo>1</radNo>
      <P05>
         <P05data>11</P05data>
      </P05>
      <PXX>
         <PXXdata>111</PXXdata>
      </PXX>
   </P01>
   <P01>
      <radNo>2</radNo>
      <P05>
         <P05data/>
      </P05>
      <PXX>
         <PXXdata>222</PXXdata>
      </PXX>
   </P01>
   <P01>
      <radNo>3</radNo>
      <P05>
         <P05data>33</P05data>
      </P05>
      <PXX>
         <PXXdata>333</PXXdata>
      </PXX>
   </P01>
</ns0:MT_TRY>

and here's the result, after the mapping i told you in the previous reply.


mesNo>
</mesNo>
<P01>
    <radNo>1</radNo>
    <PXX>
        <PXXdata>111</PXXdata>
    </PXX>
</P01>
<P01>
     <radNo>2</radNo>
     <PXX>
        <PXXdata>222</PXXdata>
     </PXX>
</P01>
<P01>
      <radNo>3</radNo>
      <PXX>
          <PXXdata>333</PXXdata>
      </PXX>
</P01>
<P01>
       <radNo>1</radNo>
       <P05>
            <P05data>11</P05data>
       </P05>
</P01>
<P01>
       <radNo>3</radNo>
       <P05>
            <P05data>33</P05data>
       </P05>
</P01>
</ns0:MT_TRY>

I think this is exactly what you are looking for.

Regards,

Lavita

Former Member
0 Kudos

That's strange. When i do the configuration I get an other result then you do.

hmmmm...

You got exactly the rigth result. I must do something wrong with my configuration.

Former Member
0 Kudos

I see a difference in your message in.

You have an empty P05data in yor second segment.

please try it without any P05 in that segment and post the result.

Former Member
0 Kudos

Hi,

Phewww!!

Done

The mapping has to be changed as follows:

For the first P01 node, keep the mapping same as discussed previously.

For radNo, instead of mapping 1:1, do this:

Use IF-without-ELSE function.

Take source side PXXdata (change its context to MT), a Constant with no value and put them on an EqualsS function. Add a boolean Not after EqualsS and put this on the IF part.

For the Then part put radNo (change its context to P01).

Give the output of IF-without-ELSE to RemoveContext to Sort (lexicographically) to SplitByValue.

This goes to Target radNo.

(same mapping for radNo of second P01 node)

For PXX node,

Use IF-without-ELSE function.

Take source side PXXdata (change its context to P01), a Constant with no value and put them on an EqualsS function. Add a boolean Not after EqualsS and put this on the IF part.

For the Then part put PXX (change its context to MT).

This goes to target PXX node.

(same mapping for P05 under the second P01 node)

This works for sure

Regards,

Lavita.

Former Member
0 Kudos

Get the following result when I test the mapping:

Compilation of rtptest successful Runtime exception during processing target field mapping /ns0:rtptest/P01/radNo. The message is: Exception:[java.lang.IllegalArgumentException: Unknown comparator type: Lexicografical] in class com.sap.aii.mappingtool.flib3.NodeFunctions method sort[com.sap.aii.mappingtool.flib3.Plainer@14311431] com.sap.aii.mappingtool.tf3.MessageMappingException: Runtime exception during processing target field mapping /ns0:rtptest/P01/radNo. The message is: Exception:[java.lang.IllegalArgumentException: Unknown comparator type: Lexicografical] in class com.sap.aii.mappingtool.flib3.NodeFunctions method sort[com.sap.aii.mappingtool.flib3.Plainer@14311431] at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:350) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:312) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:312) at com.sap.aii.mappingtool.tf3.AMappingProgram.start(AMappingProgram.java:401) at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:142) at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:105) at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInternal(ServerMapService.java:431) at com.sap.aii.ibrep.server.mapping.ServerMapService.execute(ServerMapService.java:169) at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.execute(MapServiceBean.java:52) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0_0.execute(MapServiceRemoteObjectImpl0_0.java:301) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0_0p4_Skel.dispatch(MapServiceRemoteObjectImpl0_0p4_Skel.java:146) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:320) at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:198) at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(AccessController.java:215) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170) Root Cause: com.sap.aii.utilxi.misc.api.BaseRuntimeException: Exception:[java.lang.IllegalArgumentException: Unknown comparator type: Lexicografical] in class com.sap.aii.mappingtool.flib3.NodeFunctions method sort[com.sap.aii.mappingtool.flib3.Plainer@14311431] at com.sap.aii.mappingtool.tf3.rt.C2CFunctionWrapper.cacheContext(C2CFunctionWrapper.java:97) at com.sap.aii.mappingtool.tf3.rt.C2CFunctionWrapper.gotoNextContext(C2CFunctionWrapper.java:46) at com.sap.aii.mappingtool.flib3.SplitByValue$SplitByEach.gotoNextContext(SplitByValue.java:127) at com.sap.aii.mappingtool.flib3.SplitByValue.gotoNextContext(SplitByValue.java:31) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:252) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:312) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:312) at com.sap.aii.mappingtool.tf3.AMappingProgram.start(AMappingProgram.java:401) at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:142) at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:105) at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInternal(ServerMapService.java:431) at com.sap.aii.ibrep.server.mapping.ServerMapService.execute(ServerMapService.java:169) at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.execute(MapServiceBean.java:52) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0_0.execute(MapServiceRemoteObjectImpl0_0.java:301) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0_0p4_Skel.dispatch(MapServiceRemoteObjectImpl0_0p4_Skel.java:146) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:320) at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:198) at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(AccessController.java:215) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170) RuntimeException in Message-Mapping transformation: Runtime exception during processing target field mapping /ns0:rtptest/P01/radNo. The message is: Exception:[java.lang.IllegalArgumentException: Unknown comparator type: Lexicografical] in class com.sap.aii.mappingtool.flib3.NodeFunctions method sort[com.sap.aii.mappingtool.flib3.Plainer@14311431]

Former Member
0 Kudos

I get an error from the sort function.

Former Member
0 Kudos

Hi,

Right click on the sort function in your mapping. Click on comparator and select Lexicographical.

Regards,

Lavita

Former Member
0 Kudos

This is the result I get when i implemented all the mappings mentioned above:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:rtptest xmlns:ns0="http://">

<messNo>123</messNo>

<P01>

<radNo>1</radNo>

<PXX>

<PXXdata>111</PXXdata>

</PXX>

<PXX>

<PXXdata>222</PXXdata>

</PXX>

<PXX>

<PXXdata>333</PXXdata>

</PXX>

</P01>

<P01>

<radNo>2</radNo>

</P01>

<P01>

<radNo>3</radNo>

</P01>

<P01>

<radNo>1</radNo>

<P05>

<P05data>11</P05data>

</P05>

<P05>

<P05data>33</P05data>

</P05>

</P01>

<P01>

<radNo>2</radNo>

</P01>

</ns0:rtptest>

The values in bold should be in seperate P01's.

The valuse with strike over the line should not be in the result.

Do you get the same result?

Former Member
0 Kudos

Nope,

I get the perfect output.

Former Member
0 Kudos

Can you post in a message what fields you have done specific mappings on and what message you are sending in?

My hair are beggining to get white over this problem.

Former Member
0 Kudos

I hope i don't face the same effect as you!

Here's everything about the scenario:

Source and Target Structures are the same (Data and Message type). (I've shown the structure in my previous reply)

When you are mapping them, on the target side, u Duplicate P01.

Mapping for every field is:

mesNo------messNo

for P01:


PXXdata (context MT)-------
                             --------------- EqualsS----Not------
Constant (nothing)----------                                   ---------IF-without-ELSE----P01
                                                                                PXX(context MT)-----------------

Same way for the Second P01 (the difference being P05 will be mapped instead of PXX)

Please tell me its working now !!

Regards,

Lavita

Former Member
0 Kudos

You wrote in an earlier message:

>

> Source Structure and Target Structures are

>

>rtptest

>--> mesNo

>--> P01

>----


> radNo

>----


> P05

>----


> P05data

>----


> PXX

>----


> PXXdata

My target message looks like this (Arrows on the field that are mapped to):

-->rtptest
--> mesNo 
--> P01
--------> radNo
            P05
               P05data
---------> PXX
--------------> PXXdata
--> P01
--------> radNo
---------> P05
--------------> P05data
            PXX
                 PXXdata

Can this make a difference?

Time for lunch will be back in less than an hour.

Thank you for all the help you are giving me.

Former Member
0 Kudos

Yes, thats exactly how it is done!

I hope you've got the mapping right. Please check the contexts as and how given in my previous few replies.

I could drop in a mail with the screen shots if you want.

Don't think you should have any problems after the mappings are done correctly.

Here's what I gave in as input for testing, followed by the output.


 <mesNo/>
   <P01>
      <radNo>1</radNo>
      <P05>
         <P05data>11</P05data>
      </P05>
      <PXX>
         <PXXdata>111</PXXdata>
      </PXX>
   </P01>
   <P01>
      <radNo>2</radNo>
      <PXX>
         <PXXdata>222</PXXdata>
      </PXX>
   </P01>
   <P01>
      <radNo>3</radNo>
      <P05>
         <P05data>33</P05data>
      </P05>
      <PXX>
         <PXXdata>333</PXXdata>
      </PXX>
   </P01>
</ns0:MT_TRY>


<mesNo>
</mesNo>
<P01>
    <radNo>1</radNo>
    <PXX>
        <PXXdata>111</PXXdata>
     </PXX>
</P01>
<P01>
    <radNo>2</radNo>
    <PXX>
        <PXXdata>222</PXXdata>
    </PXX>
</P01>
<P01>
    <radNo>3</radNo>
    <PXX>
         <PXXdata>333</PXXdata>
    </PXX>
</P01>
<P01>
    <radNo>1</radNo>
    <P05>
        <P05data>11</P05data>
    </P05>
</P01>
<P01>
    <radNo>3</radNo>
    <P05>
       <P05data>33</P05data>
    </P05>
</P01></ns0:MT_TRY>

-Lavita

Former Member
0 Kudos

Question:

You write this:

>

For radNo, instead of mapping 1:1, do this:

Use IF-without-ELSE function.

Take source side PXXdata (change its context to MT), a Constant with no value and put them on an EqualsS function. Add a boolean Not after EqualsS and put this on the IF part.

For the Then part put radNo (change its context to P01).

Give the output of IF-without-ELSE to RemoveContext to Sort (lexicographically) to SplitByValue.

This goes to Target radNo.

(same mapping for radNo of second P01 node)

For the radNo of second P01 should I use P05data into the equalsS function?

And when I do the P05 node in the second P01 do I use P05 where you have writen PXX and P05data where you have writen PXXdata?

Former Member
0 Kudos

Yes

Exactly that..!

For the radNo of second P01, use P05data into the equalsS function?

And for the P05 node in the second P01, use P05 whereI have writen PXX and P05data where I have writen PXXdata.

Hope it's all clear and working well now!

Regards,

Lavita.

Do reward points if useful.

Thanks!

Former Member
0 Kudos

This is how I've mapped it so far:

mesNo--->mesNo

P01(for PXX)
PXXdata(content rtptest) ----
                                        ---------- equalsS ---------- Not ----------
constant [] ------------------------                                                  ---------- IF without ELSE ---------- P01(for PXX)
                                                  PXX (content rtptest) ----------

radNo in P01(for PXX)
PXXdata(content rtptest) ----
                                        ---------- equalsS ---------- Not ----------
constant [] ------------------------                                                  ---------- IF without ELSE ---------- removecontext---------- sort (Lexicographical) ---------- SplitByValue (each value)---------- P01(for PXX)
                                                  radNo (content P01) ----------

PXX in P01(for PXX)
PXXdata(content P01) ----
                                        ---------- equalsS ---------- Not ----------
constant [] ------------------------                                                  ---------- IF without ELSE ---------- P01(for PXX)
                                                  PXX (content rtptest) ----------

PXXdata in P01(for PXX)
PXXdata ---------- PXXdata


P01 (for P05)
P05data(content rtptest) ----
                                        ---------- equalsS ---------- Not ----------
constant [] ------------------------                                                  ---------- IF without ELSE ---------- P01(for P05)
                                                  P05 (content rtptest) ----------

radNo in P01(for P05)
P05data(content rtptest) ----
                                        ---------- equalsS ---------- Not ----------
constant [] ------------------------                                                  ---------- IF without ELSE ---------- removecontext---------- sort (Lexicographical) ---------- SplitByValue (each value)---------- P01(for PXX)
                                                  radNo (content P01) ----------

P05 in P01(for P05)
P05data(content P01) ----
                                        ---------- equalsS ---------- Not ----------
constant [] ------------------------                                                  ---------- IF without ELSE ---------- P01(for PXX)
                                                  P05 (content rtptest) ----------

P05data in P01(for P05)
P05data ---------- P05data

Former Member
0 Kudos

I'm sedning in this message:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:rtptest_2 xmlns:ns0="http://">
   <messNo>123</messNo>
   <P01>
      <radNo>1</radNo>
      <P05>
         <P05data>11</P05data>
      </P05>
      <PXX>
         <PXXdata>111</PXXdata>
      </PXX>
   </P01>
   <P01>
      <radNo>2</radNo>
      <PXX>
         <PXXdata>222</PXXdata>
      </PXX>
   </P01>
   <P01>
      <radNo>3</radNo>
      <P05>
         <P05data>33</P05data>
      </P05>
      <PXX>
         <PXXdata>333</PXXdata>
      </PXX>
   </P01>
</ns0:rtptest_2>

And are getting this result:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:rtptest_2 xmlns:ns0="http://">
<messNo>123</messNo>
   <P01>
   <radNo>1</radNo>
      <PXX>
      <PXXdata>111</PXXdata>
      </PXX>
      <PXX>
      <PXXdata>222</PXXdata>
      </PXX>
      <PXX>
      <PXXdata>333</PXXdata>
      </PXX>
   </P01>
   <P01>
   <radNo>1</radNo>
   </P01>
   <P01>
   <radNo>1</radNo>
   </P01>
   <P01>
   <radNo>1</radNo>
      <P05>
      <P05data>11</P05data>
      </P05>
      <P05>
      <P05data>33</P05data>
      </P05>
   </P01>
   <P01>
   <radNo>1</radNo>
   </P01>
</ns0:rtptest_2>

As you see i don't get the result I'm looking for.

I must have something different then you have because you are getting the rigth result.

This time I did the mapping on a fresh copy so there was no old maps that had to be removed.

Getting frustrated that i can't find what i'm doing wrong.

Former Member
0 Kudos

Hey!

Ya its almost perfect. Just a small change and you'll be through.

While you map PXX node and P05 node, add a SplitByValue after the IF-without-ELSE !

Thats the only difference between my mapping and yours.

All the best!

Regards,

Lavita.

Former Member
0 Kudos

As you said almost there.

After I added the SplitByValue I get all PXX under the same radNo in the same P01 and i get all the P05 under the same radNo in the second P01.

You get them seperated?

Former Member
0 Kudos

Yes,

As a matter of fact, I do get them separate.

Check if you have mapped P01 correctly.

Is rtpTest the name of your Message Type?

Former Member
0 Kudos

Yes rtptest are the name of my message type.

I will check my P01's

Former Member
0 Kudos

The occurance of P01 should be 0..unbounded.

Let me know if the problem is solved.

Former Member
0 Kudos

Now we are getting as result:

<?xml version="1.0" encoding="UTF-8"?>
<ns0:rtptest xmlns:ns0="http://">
   <messNo>123</messNo>
   <P01>
   <radNo>1</radNo>
      <PXX>
      <PXXdata>111</PXXdata>
      </PXX>
   </P01>
   <P01>
   <radNo>2</radNo>
      <PXX>
      <PXXdata>222</PXXdata>
      </PXX>
   </P01>
   <P01>
   <radNo>3</radNo>
      <PXX>
      <PXXdata>333</PXXdata>
      </PXX>
   </P01>
   <P01>
   <radNo>1</radNo>
      <P05>
      <P05data>11</P05data>
      </P05>
   </P01>
   <P01>
   <radNo>2</radNo>
      <P05>
      <P05data>33</P05data>
      </P05>
   </P01>
</ns0:rtptest>

As you see we get the wrong radNo for the last P05.

Former Member
0 Kudos

Hi,

Is the sort function working all right for radNo? Check the queue. The supressed value should be last when sort arranges values lexicographically.

With the input you are giving, it should sort as

[1]

[3]

SUPRESS

Are you getting this?

Regards,

Lavita

Former Member
0 Kudos

Was getting late yesterday so I left for the evening.

Had to pick up my son from daycare.

Came back this morning made some small changes and now it's working perfectly.

Thanks you Lavita for all the help.

I hope I can help you some time.

Points on the way.

I hope you have the best day ever!

Former Member
0 Kudos

Now this makes my day several shades brighter already!

Thanks for being so generous in appreciating. It was a learning and fun experience for me too. So, thank you for that!

Hope you have a fantastic day as well!

Regards,

Lavita.

Former Member
0 Kudos

Hi again Lavita.

Have an other questione to you hand hope that you will read this message.

With the solution we made we got the following result:

<mesNo>
</mesNo>
<P01>
    <radNo>1</radNo>
    <PXX>
        <PXXdata>111</PXXdata>
     </PXX>
</P01>
<P01>
    <radNo>2</radNo>
    <PXX>
        <PXXdata>222</PXXdata>
    </PXX>
</P01>
<P01>
    <radNo>3</radNo>
    <PXX>
         <PXXdata>333</PXXdata>
    </PXX>
</P01>
<P01>
    <radNo>1</radNo>
    <P05>
        <P05data>11</P05data>
    </P05>
</P01>
<P01>
    <radNo>3</radNo>
    <P05>
       <P05data>33</P05data>
    </P05>
</P01></ns0:MT_TRY>

Do you know if it's easy to change the result to this?

<mesNo>
</mesNo>
<P01>
    <radNo>1</radNo>
    <PXX>
        <PXXdata>111</PXXdata>
     </PXX>
</P01>
<P01>
    <radNo>1</radNo>
    <P05>
        <P05data>11</P05data>
    </P05>
</P01>
<P01>
    <radNo>2</radNo>
    <PXX>
        <PXXdata>222</PXXdata>
    </PXX>
</P01>
<P01>
    <radNo>3</radNo>
    <PXX>
         <PXXdata>333</PXXdata>
    </PXX>
</P01>
<P01>
    <radNo>3</radNo>
    <P05>
       <P05data>33</P05data>
    </P05>
</P01></ns0:MT_TRY>

As you see I'm after getting the P01's with the same radNo after each other.

BR

Kalle

Former Member
0 Kudos

Hi Kalle,

The easiest way to do this would be to add a parent node to P01 on your Target side. This will change your Data Type (target structure), Mapping and Output display slightly.

The Target Structure will be as follows (Data Type)


mesNo
P01_head
-->P01
------->radNo
------->PXX
------------>PXXdata
------->P05
------------>P05data

Now while Mapping, you duplicate P01 once (i.e your P01_head will have two P01's in it)

The mapping is as follows:


*mesNo*
mesNo --------- mesNo

*P01_head*
radNo (context MT) -------- exists -------- createIf ------- P01_head

*P01*
PXXdata (context P01) ----- exists -----createIf ------P01
radNo ----- radNo
PXX -------- PXX
PXXdata ------- PXXdata

*P01(1)*
P05data (context P01) ----- exists -----createIf ------P01
radNo ----- radNo
P05 -------- P05
P05data ------- P05data

The output looks like this


<mesNo></mesNo>
<P01_head>
   <P01>
       <radNo>1</radNo>
       <PXX>
           <PXXdata>111</PXXdata>
       </PXX>
   </P01>
   <P01>
       <radNo>1</radNo>
       <P05>
           <P05data>11</P05data>
       </P05>
   </P01>
</P01_head>
<P01_head>
   <P01>
       <radNo>2</radNo>
       <PXX>
            <PXXdata>222</PXXdata>
      </PXX>
  </P01>
</P01_head>
<P01_head>
   <P01>
       <radNo>3</radNo>
       <PXX>
            <PXXdata>333</PXXdata>
       </PXX>
    </P01>
    <P01>
        <radNo>3</radNo>
        <P05>
            <P05data>33</P05data>
        </P05>
    </P01>
</P01_head>
</ns0:MT_TRY_RX>

Do let me know if its fulfilling your purpose or we shall think of a better solution.

Regards,

Lavita

Former Member
0 Kudos

Hi Latvia.

I'm not sure if the project would be happy with the soultion.

On radNo, PXX. PXXdata and so on I wiould use the same mappings as we did before?

How complicated would it be to solve without the P01-head?

I've been thinking about this since yesterday when my projectmanager recuested it.

I was think8ing about pushing the P01 with the data in a the other segments and use or between the diffrent segments and then put all that into a IfWithoutElse. But that didn't work. Gave the same result as without the extra mapping.

Could it be a good thing to Push the P01 With RadNo and see if i can do that togheter with the P05data?

Or will taht give the same result?

BR

Kalle

Former Member
0 Kudos

Hi,

If you use this above given method, the mapping for every field changes. I have shown it under the P01s that radNo, PXX, PXXdata are mapped directly now. Check the mapping I've given above.

I am trying other ways, such that the output does not change at all. Shall revert back as soon as I have the solution in hand.

Regards,

Lavita.

Former Member
0 Kudos

Thanks Lavita.

you are the best.

Former Member
0 Kudos

Hi Kalle,

Sorry for the late reply.

Are you comfortable with UDF's?

I have found out the solution using UDF's. Just let me know if your well-versed with creating them or I shall explain everything in elaborate details.

Do let me know.

Regards,

Lavita.

Former Member
0 Kudos

Hi/morning Lavita.

I've cretaed some UDF's so it should not be a big problem if that's included.

Fire up and lets see where we end up...

//Kalle

Former Member
0 Kudos

Okay

Here you go!

For P01

Label: P01

Context

Arguments: 3


for (int j = 0; j<a.length ; j++)
{
 if ( b[j].equals("true"))
{
   result.addValue("");
}
else 
{
result.addValue(SUPPRESS);
}

if ( c[j].equals("true"))
{
   result.addValue("");
}
else 
{
result.addValue(SUPPRESS);
}
}

For radNo

Label: radNo

Context

Arguments: 4


  for (int j = 0; j<a.length ; j++)
{
 if ( b[j].equals("true"))
{
   result.addValue(d[j]);
}
else 
{
result.addValue(SUPPRESS);
}

if ( c[j].equals("true"))
{
   result.addValue(d[j]);
}
else 
{
result.addValue(SUPPRESS);
}
}

For P05

Label: P05_NODE

Context

Arguments: 4


for (int j = 0; j<a.length ; j++)
{
if ( c[j].equals("true"))
{
result.addValue(SUPPRESS);
}
else
{
result.addValue(SUPPRESS);
}
 if ( b[j].equals("true"))
{
   result.addValue(d[j]);
}
else
{
result.addValue(SUPPRESS);
}
}

For PXX

Label : PXX_NODE

Context

Arguments : 4


   for (int j = 0; j<a.length ; j++)
{
 if ( b[j].equals("true"))
{
   result.addValue(d[j]);
}
else
{
  result.addValue(SUPPRESS);
   }
  if ( c[j].equals("true"))
  {
   result.addValue(SUPPRESS);
   }
else 
{
result.addValue(SUPPRESS);
}
}

Continues in the next post..

Regards,

Lavita

Former Member
0 Kudos

Now map as follows.

P01


radNo-----------------------------}
PXXdata (context P01)---exists----}----P01(UDF)----RemoveContext----P01
P05data (context P01)----exists---}

radNo


P01----SplitByValue(each value)--}
PXXdata (context P01)---exists---}---radNo(UDF)---SplitByValue(each value)---radNo
P05data (context P01)----exists--}
radNo----------------------------}

P05


P01---SplitByValue(each value)---}
P05data (context P01)----exists--}--P05_NODE(UDF)--SplitByValue(each value)---P05
PXXdata (context P01)---exists---}
P05------------------------------}

P05data


P01---SplitByValue(each)---------}
P05data (context P01)--exists----}--P05_NODE(UDF)--SplitByValue(each)--P05data
PXXdata (context P01)---exists---}
P05data (context P01)-------------}

PXX


P01---SplitByValue(each value)---}
PXXdata (context P01)---exists---}--PXX_NODE(UDF)--SplitByValue(each)--PXX
P05data (context P01)----exists--}
PXX------------------------------}

PXXdata


P01---SplitByValue(each value)---}
PXXdata (context P01)---exists---}--P05_NODE(UDF)--SplitByValue(each)--PXXdata
P05data (context P01)---exists---}
PXXdata (context P01)------------}

Done!

All the best.

Regards,

Lavita.

Former Member
0 Kudos

Will try it out rigth away.

Thanks.

Former Member
0 Kudos

A fast question.

Should the target structure look like this now?

<P01>
   <radNo>
   <P05>
      <P05data>
   <PXX>
      <PXXdata>
   <PYY>
      <PYYdata>

Answers (3)

Answers (3)

Former Member
0 Kudos

works this way

/ns0:rtptest/messNo=/ns0:rtptest/messNo

/ns0:rtptest/P01=removeContexts(createIf(exists(/ns0:rtptest/P01/P05/P05data ))) /ns0:rtptest/P01/radNo=/ns0:rtptest/P01/radNo= /ns0:rtptest/P01/PXX=const([value=]) /ns0:rtptest/P01/PXX/PXXdata=/ns0:rtptest/P01/P05/P05data= /ns0:rtptest/P01[1]=removeContexts(createIf(exists(/ns0:rtptest/P01/PXX/PXXdata=))) /ns0:rtptest/P01[1]/radNo=/ns0:rtptest/P01/radNo= /ns0:rtptest/P01[1]/PXX=const([value=]) /ns0:rtptest/P01[1]/PXX/PXXdata=/ns0:rtptest/P01/PXX/PXXdata

P05data and PXXdata are in context of P01

The P01 field on the target field is duplicated.

That's pitty that the forum doesn't allow to attach files. I'd attach the xim mapping project file.

Best regards

Dmitry

GabrielSagaya
Active Contributor
0 Kudos

PXXDATA EQUALS CONSTANT ("") -> NOT -> IFWITHOUTELSE->

REMOVECONTEXT->COLLAPSECONTEXT->SPLITBY VALUE(value change)->P01

radno-->radno

pxxdata->pxxdata

checking whether source data exist then create target parent node wrt source node.

Former Member
0 Kudos

That config only gets me the first of the second P01.

Former Member
0 Kudos

Hi Kalle,

Check wheater the Occurence given is correct or not .........do let me know ............!

Regards,

Azeez khan.

Former Member
0 Kudos

This is how my source message looks:

<rtptest>     1...1
<messNo>     0...1
   <P01>     0...unbounded
   <radNo>     0...1
      <P05>     0...unbounded
      <P05data>     0...1
      <PXX>     0...unbounded
      <PXXdata>     0...unbounded

And this is how my target message looks:


<rtptest>     1...1
<messNo>     0...1
   <P01>     0...unbounded
   <radNo>     0...1
      <PXX>     0...unbounded
      <PXXdata>     0...unbounded
   <P01>     0...unbounded
   <radNo>     0...1
      <P05>     0...unbounded
      <P05data>     0...1