cancel
Showing results for 
Search instead for 
Did you mean: 

mapping - message split

Former Member
0 Kudos

Hi all,

I need a little bit help with message splitting.

I have message structure like below. The Error Node exists in all rows, in first part it is initial (with no value), then come rows with different error messages.

<Message1>
  <Row>
    <node1>a</node1>
    <node2>a</node2>
    <Errror/>
  </Row>
  <Row>
    <node1>a</node1>
    <node2>a</node2>
    <Errror/>
  </Row>
  ...
  <Row>
    <node1>a</node1>
    <node2>a</node2>
    <Errror>text_a</Errror>
  </Row>
  <Row>
    <node1>a</node1>
    <node2>a</node2>
    <Errror>text_b</Errror>
  </Row>
  ...
</Message1>

I need to split it into 2 messages so, that in first message will be rows without error, and in the second with.

<Message1>
  <Row>
    <node1>a</node1>
    <node2>a</node2>
  </Row>
  <Row>
    <node1>a</node1>
    <node2>a</node2>
  </Row>
  ...
</Message1>
<Message2>
  <Row>
    <node1>a</node1>
    <node2>a</node2>
    <Errror>text_a</Errror>
  </Row>
  <Row>
    <node1>a</node1>
    <node2>a</node2>
    <Errror>text_b</Errror>
  </Row>
  ...
</Message2>

Is this feasible with graphical mapping? How can I can make the assignment of the row once to first and

other time to second message? Or do I have to use XSLT/ABAP? (I am not very familiar with java...) Thanks for any suggestions.

Accepted Solutions (1)

Accepted Solutions (1)

prateek
Active Contributor
0 Kudos

Is this feasible with graphical mapping?

Yes.

How can I can make the assignment of the row once to first and other time to second message?

It seems that you don't map anything from Error Node in first target structure. So it would be a simple mapping.

Regards,

Prateek

Answers (3)

Answers (3)

Former Member
0 Kudos

Hello,

Prateek, Jude,

I think you did not get the point.When I map it just in the simple way it will look like this:

Input rows:

1 - no error

2 - no error

3 - error

4 - error

5 - error

Output

Message1 rows:

1,2,3,4,5

Message2 rows:

1,2,3,4,5

I will have 10 rows in output (I want to have just 5 and in this way M1-1,2; M2-3,4,5).

Udo,

I have tried already this approach. However it does not work as desired.

I have mapped:

Error node -> not -> exists -> if

Input_message_Row -> then

output -> Output_message1_Row

Error node -> exists -> if

Input_message_Row -> then

output -> Output_message2_Row

However the decision is made on the first row, and the first row is mapped also to second message, and that is all. The next rows are not considered at all:

Input:
<ns0:Messages xmlns:ns0=...>
   <ns0:Message1>
      <ns1:MT...>
         <Row>
            <test1>11</test1>
            <Errror/>
         </Row>
         <Row>
            <test1>111</test1>
            <Errror/>
         </Row>
         <Row>
            <test1>111bb</test1>
            <Errror/>
         </Row>
         <Row>
            <test1>11a</test1>
            <Errror>a</Errror>
         </Row>
         <Row>
            <test1>11axx</test1>
            <Errror>axx</Errror>
         </Row>
      </ns1:MT...>
   </ns0:Message1>
</ns0:Messages>

Output:
<ns0:Messages xmlns:ns0=...>
   <ns0:Message1>
      <ns1:MT...>
         <Row>
            <test1>11</test1>
         </Row>
      </ns1:MT...>
   </ns0:Message1>
   <ns0:Message2>
      <ns1:MT2...>
         <Row>
            <test1>11</test1>
            <Errror/>
         </Row>
      </ns1:MT2...>
   </ns0:Message2>
</ns0:Messages>

udo_martens
Active Contributor
0 Kudos

Hi Vladimir,

Errror and Row need to be in same context, change the context of Errror to Message1.

Regards,

Udo

Former Member
0 Kudos

Hi Udo,

excuse me, but this is not clear to me...

I understand what is context change.

However in this case, I am a little bit lost.

Can you describe it a little bit more? Should I use the function "collapseContexts"? Should I map the Error node to Message1? The occurance of Message1 is just 1, only the occurance of Row is 0..unbounded. And the Row Node is already mapped in the IF function.

So shoud the context change be involved somewhere in the IF function?

Thanks for answers,

Vladimir

Former Member
0 Kudos

Hello,

I have solved the issue.

The mapping delivering the desired result is:

1) for first row

Error node -> removeContext ->lenght -> equalsA -> if

constant[0] -> equalsA

Input_message_Row -> then

output -> Output_message1_Row

1) for second row

Error node -> removeContext ->lenght -> greater -> if

constant[0] -> greater

Input_message_Row -> then

output -> Output_message2_Row

Thanks for help (speciely Udo).

Vladimir

Former Member
0 Kudos

Hi ,

Yes , its possible . You can solve the problem using graphical mapping .

In the target side you have two messages 1 and 2 .

So map the Error node to the 2 nd message only.

Regards,

B.Jude

udo_martens
Active Contributor
0 Kudos

Hi Vladimir,

>Is this feasible with graphical mapping?

Yes, map Row twice with condition: IF (without else) exists Errror (put context to Message1)

>XSLT

for-each select="//Row[string-length(Errror) gt 0]"

Regards,

Udo