Skip to Content
avatar image
Former Member

message mapping--Context related

<b>Input file:</b>

<?xml version="1.0" encoding="UTF-8" ?> 
- <Group01>
  <Field1>A1</Field1> 
  <Field2>A1_B1</Field2> 
  <Field3>A1_B1_C1</Field3> 
  </Group01>
- <Group01>
  <Field1>A1</Field1> 
  <Field2>A1_B2</Field2> 
  <Field3>A1_B2_C1</Field3> 
  </Group01>
- <Group01>
  <Field1>A1</Field1> 
  <Field2>A1_B2</Field2> 
  <Field3>A1_B2_C2</Field3> 
  </Group01>
- <Group01>
  <Field1>A2</Field1> 
  <Field2>A2_B1</Field2> 
  <Field3>A2_B1_C1</Field3> 
  </Group01>
- <Group01>
  <Field1>A2</Field1> 
  <Field2>A2_B2</Field2> 
  <Field3>A2_B2_C1</Field3> 
  </Group01>
- <Group01>
  <Field1>A2</Field1> 
  <Field2>A2_B2</Field2> 
  <Field3>A2_B2_C2</Field3> 
  </Group01>

<b>Output file</b>

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

   <Group1>
      <Feld1>A1</Feld1>
      <Group2>
         <Feld2>A1_B1</Feld2>
         <Group3>
            <Feld3>A1_B1_C1</Feld3>
         </Group3>
      </Group2>
      <Group2>
         <Feld2>A1_B2</Feld2>
         <Group3>
            <Feld3>A1_B2_C1</Feld3>
         </Group3>
         <Group3>
            <Feld3>A1_B2_C2</Feld3>
         </Group3>
      </Group2>
   </Group1>
   <Group1>
      <Feld1>A2</Feld1>
      <Group2>
         <Feld2>A2_B1</Feld2>
         <Group3>
            <Feld3>A2_B1_C1</Feld3>
         </Group3>
      </Group2>
      <Group2>
         <Feld2>A2_B2</Feld2>
         <Group3>
            <Feld3>A2_B2_C1</Feld3>
         </Group3>
         <Group3>
            <Feld3>A2_B2_C2</Feld3>
         </Group3>
      </Group2>
   </Group1>

Is it possible to do XI mapping without writing any UDF?

Thanks

Shubhankar

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Sep 12, 2007 at 04:14 AM

    Yes it is possible. Just use standard node functions

    Regards,

    Prateek

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Group1 and field1 are working but other groups are not working.

      Field1(context to test02)-->SplitbyValue(value changed)-->CollapseContexts-->Group1

      Field1(context to test02)-->SplitbyValue(value changed)-->CollapseContexts-->SplitByValue(each value) -->Field1

      Now I am trying for Group2 and field2 but still I don't have answer.

      If you have any answer then please tell me.

      Thanks

      Shubhankar

  • avatar image
    Former Member
    Sep 12, 2007 at 09:49 AM

    Just use direct mapping as follows:

    Group01 --> Group1

    Field1 --> Feld1

    Field2 --> Group2

    Field2 --> Feld2

    Field3 --> Group3

    Field3 --> Feld3

    No other Context functions are needed.

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 12, 2007 at 01:47 PM

    Shubankar,

    The below logic will solve your issue.

    <b>Field1</b>[Change Context to higher node]-SplitByValue[Value Changed]-CollapseContext---<b>Group1</b>

    <b>Field1</b>[Change Context to higher node]-SplitByValue[Value Changed]-SplitByValue[EachValue]----<b>Field1</b>

    <b>Field1</b>SplitByValue[Value Changed]-<b>Group2</b>

    <b>Field2</b>---<b>Field2</b>

    If the occurrence of <b>Group3 is 1..1</b> then don't map anything.

    If the occurrence of <b>Group3 is 0..1</b> then map like below

    Constant[]----Group3

    <b>Field3</b>[Change Context to higher node]-SplitByValue[EachValue]-<b>Field3</b>

    raj.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 12, 2007 at 05:39 PM

    Hi Raj,

    As per your suggestion I am getting below output

    <?xml version="1.0" encoding="UTF-8" ?> 
    - <Group1>
      <Feld1>A1</Feld1> 
    - <Group2>
      <Feld2>A1_B1</Feld2> 
    - <Group3>
      <Feld3>A1_B1_C1</Feld3> 
      </Group3>
      </Group2>
      </Group1>
    - <Group1>
      <Feld1>A2</Feld1> 
    - <Group2>
      <Feld2>A1_B2</Feld2> 
    - <Group3>
      <Feld3>A1_B2_C1</Feld3> 
      </Group3>
      </Group2>
      </Group1>

    I was trying with below rule for Group2

    					Field2------------------
    									formatByEample  Group2
    Field1[Change Context to higher node]--SplitByValue[Value Changed]

    and it is almost working and giving the snapshot of my output. You can see same value A1_B2 is coming twice but I am expecting only one A1_B1. that is not happening.

    - <Group2>
      <Feld2>A1_B2</Feld2> 
    - <Group3>
      <Feld3>A1_B2_C1</Feld3> 
      </Group3>
      </Group2>
    - <Group2>
      <Feld2>A1_B2</Feld2> 
    - <Group3>
      <Feld3>A1_B2_C2</Feld3> 
      </Group3>
      </Group2>

    Thanks

    Shubhankar

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 12, 2007 at 06:28 PM

    Hi Raj,

    A1_B2 is coming twice in your output. I need only one time and under this it should create 2 group3 (A1_B2_c1 and A1_B2_C2).

     <Group2>
             <Feld2>A1_B2</Feld2>
             <Group3>
                <Feld3>A1_B2_C1</Feld3>
             </Group3>
             <Group3>
                <Feld3>A1_B2_C2</Feld3>
             </Group3>
          </Group2>

    Thanks for your help.

    Regards,

    Shubhankar

    Add comment
    10|10000 characters needed characters exceeded