locked
Mapping: aggregate some nodes based on element value. RRS feed

  • Question

  •  

    hi,

    I have a XML which has an header and a repeating structure. I copied the repeating structure below:

      <asnLu>
            <lineNumber>1</lineNumber>
            <productId>1-14-27-08</productId>
            <uomName>EACH</uomName>
            <quantityReceived>200.0</quantityReceived>
            <attributeValue>
                <name>barcode</name>
                <value>NONE</value>
            </attributeValue>
            <attributeValue>
                <name>lotCode</name>
                <value>85</value>
            </attributeValue>
            <attributeValue>
                <name>stockOwner</name>
                <value>05</value>
            </attributeValue>
            <attributeValue>
                <name>stockStatus</name>
                <value>V</value>
            </attributeValue>
            <attributeValue>
                <name>warehouse</name>
                <value>VRO</value>
            </attributeValue>
        </asnLu>
        <asnLu>
            <lineNumber>1</lineNumber>
            <productId>2-22-33-31</productId>
            <uomName>EACH</uomName>
            <quantityReceived>99.0</quantityReceived>
            <attributeValue>
                <name>barcode</name>
                <value>NONE</value>
            </attributeValue>
            <attributeValue>
                <name>lotCode</name>
                <value>85</value>
            </attributeValue>
            <attributeValue>
                <name>stockOwner</name>
                <value>05</value>
            </attributeValue>
            <attributeValue>
                <name>stockStatus</name>
                <value>V</value>
            </attributeValue>
            <attributeValue>
                <name>warehouse</name>
                <value>VRO</value>
            </attributeValue>
        </asnLu>
        <asnLu>
            <lineNumber>1</lineNumber>
            <productId>1-14-27-08</productId>
            <uomName>EACH</uomName>
            <quantityReceived>99.0</quantityReceived>
            <attributeValue>
                <name>barcode</name>
                <value>NONE</value>
            </attributeValue>
            <attributeValue>
                <name>lotCode</name>
                <value>85</value>
            </attributeValue>
            <attributeValue>
                <name>stockOwner</name>
                <value>05</value>
            </attributeValue>
            <attributeValue>
                <name>stockStatus</name>
                <value>V</value>
            </attributeValue>
            <attributeValue>
                <name>warehouse</name>
                <value>VRO</value>
            </attributeValue>
        </asnLu>

    As you can see the xml has 3 ASNLU nodes where 2 of them has the same ProductID. Now i want to map this XML to a destination XML.

    But if the productID and the stockStatus value are the same, the output has to be 1 anslu. So the output XML should look like this:

    <asnLu>
     <lineNumber>1</lineNumber>
     <productId>1-14-27-08</productId>
     <uomName>EACH</uomName>
     <quantityReceived>299.0</quantityReceived>
     <attributeValue>
      <name>barcode</name>
      <value>NONE</value>
     </attributeValue>
     <attributeValue>
      <name>lotCode</name>
      <value>85</value>
     </attributeValue>
     <attributeValue>
      <name>stockOwner</name>
      <value>05</value>
     </attributeValue>
     <attributeValue>
      <name>stockStatus</name>
      <value>V</value>
     </attributeValue>
     <attributeValue>
      <name>warehouse</name>
      <value>VRO</value>
     </attributeValue>
    </asnLu>
    <asnLu>
     <lineNumber>2</lineNumber>
     <productId>2-22-33-31</productId>
     <uomName>EACH</uomName>
     <quantityReceived>99.0</quantityReceived>
     <attributeValue>
      <name>barcode</name>
      <value>NONE</value>
     </attributeValue>
     <attributeValue>
      <name>lotCode</name>
      <value>85</value>
     </attributeValue>
     <attributeValue>
      <name>stockOwner</name>
      <value>05</value>
     </attributeValue>
     <attributeValue>
      <name>stockStatus</name>
      <value>V</value>
     </attributeValue>
     <attributeValue>
      <name>warehouse</name>
      <value>VRO</value>
     </attributeValue>
    </asnLu>

    All the values are mapped 1:1 exept the quantityReceived, i want to use the Cumulative Sum functoid for that.

    So can anyone give me a advise for this issue?

    Wednesday, November 14, 2012 10:33 AM

Answers