on 05-12-2008 10:43 AM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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
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?
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
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.
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]
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?
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
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.
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
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?
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
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.
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.
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
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
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
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.
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
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kalle,
Check wheater the Occurence given is correct or not .........do let me know ............!
Regards,
Azeez khan.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.