AnsweredAssumed Answered

Can a Decision Shape check repeating xml elements and route if certain value is found?

Question asked by GuinScholl3001 on Apr 27, 2016
Latest reply on Apr 28, 2016 by Adam Arrowsmith
Branched to a new discussion

Can a Decision Shape check repeating xml elements and route if any of the repeating elements have a certain value?  It doesn't seem to be working for me.   I'm hoping someone may be able to suggest an elegant way to handle the following scenario.

 

I have a process that returns a large XML document containing a list of SKUs.   I split it by SKU so that i have one document for each SKU.    Each SKU has an element called Attributes which has a repeating child element called ProductAttribute which contains a Name and Value pair.  SKUs can have 0 to many ProductAttributes.

 

QUESTION: I would like to Route the documents based on whether a Particular ProductAttribute with a Name = "Color" is found for each SKU.  Some will have the Product Attribute and some will not.  Also, the ProductAttribute Name to filter for will be passed in from a calling process.  So it has to be dynamic.  The process might also be called the next time to filter for a ProductAttribute with a Name = "Composition" rather than "Color".

 

Here is an example of the structure after I have split the document so that I have one doc per SKU.

 

For the examples below, Document #1 should go down one path because it contained a ProductAttribute with a Name = "Color", while Document #2 should go down an alternate path because it does not contain that Product Attribute.

 

Thanks in advance for any pointers on the best (easiest) way to handle.

 

Document #1

<SKU>

   <Name>Test SKU A</Name>

<Attributes>

       <ProductAttribute>

            <Name>Type</Name>

            <Value>Uncirculated</Value>

       </ProductAttribute>

       <ProductAttribute>

            <Name>Color</Name>

            <Value>Blue</Value>

       </ProductAttribute>

</Attributes>

</SKU>

 

Document #2

<SKU>

   <Name>Test SKU B</Name>

<Attributes>

       <ProductAttribute>

            <Name>Type</Name>

            <Value>Uncirculated</Value>

       </ProductAttribute>

       <ProductAttribute>

            <Name>Composition</Name>

            <Value>Silver</Value>

       </ProductAttribute>

</Attributes>

</SKU>

Outcomes