Washington DC Endpoint Management User Group

 View Only
  • 1.  Workflow - Remove Items in one Collection that Exist In another

    Posted Sep 01, 2012 03:47 PM

    I am trying to use the Remove Items in Collection component to remove items in one collection if they exist in another collection. Both collections have the same data type. However, nothing is ever removed??? Is it matching on index or something?



  • 2.  RE: Workflow - Remove Items in one Collection that Exist In another

    Posted Sep 03, 2012 03:41 AM

    The component Remove Items From Collection uses Remove(..) method from System.Collections.ArrayList .NET class which is based on equality checking by calling Object.Equals(..).
    The default implementation of Equals supports reference equality for reference types, and bitwise equality for value types. There is one exception - strings (Text data types) are treated as value type.

    So, in your case, removing items from collection by pointing at elements from another collection will work only for collections of simple data types (Texts, Numbers etc.).

    For complex data types you can solve this problem by using Configurable Collection Filter on base collection using as a filtering criteria elements from another collection and then pass filtering result to Remove component.



  • 3.  RE: Workflow - Remove Items in one Collection that Exist In another

    Posted Sep 04, 2012 12:12 PM

    do you need the remove component though? Configurable Collection Filter will already filter out the item.

     

    Also, wouldn't you have to use the For Each Item in Collection then?



  • 4.  RE: Workflow - Remove Items in one Collection that Exist In another

    Posted Sep 05, 2012 03:09 AM

    1) Rigth, no, you don't. By using the Filter component you should get the same results.

    2) There is no need to use Remove component inside For Each loop. The Remove Items components can take many elements on input, including collections, and it has its own internal foreach loop.