Workflow and ServiceDesk Community

 View Only
  • 1.  Configurable Collection Sort - eh?

    Posted Oct 28, 2011 08:11 AM

    Dear All,

    Does anyone have any information for how to use the Configurable Collection Sort component? It has a nice option over the Simple Collection Sort to be able to copy the Collection into another Array.

    If I could have a quick example of how to use the Configurable Collection Sort component to do the same as the Simple Collection Sort (i.e. Alphabetically), that would be enough and might be useful for showing how to implement other sort types.

    The documentation is not very clear and there are no worked examples in the Help.

    Kindest regards,

     

    QuietLeni



  • 2.  RE: Configurable Collection Sort - eh?

    Posted Oct 31, 2011 06:31 AM

    Component Configurable Collection Sort wraps the method Sort() from ArrayList .NET class. The sort models are elements of comparator (implementing IComparer interface) called for each pair comparison done during QucikSort algorithm processing.

    The comparator works for each pair in following way:

    1. Checks the identity of two elements
      Identical => returns with equality result
      Not identical => continues
    2. Checks the elements order using 1st level sort model
      Not equal => returns with greater or less result
      Equal => checks if highest sort level is 1: if yes returns with equality result, else continues
    3. Checks the elements order using 2nd level sort model
      Not equal => returns with greater or less result
      Equal => checks if highest sort level is 2: if yes returns with equality result, else continues
    4. Etc. analogical for further sorting models

    Such implementation lets for sorting using more then one criterion e.g. sorting complex data types using more then one filed. For instance, an array built of complex type Person objects containing two fields FirstName and SecondName could be sorted alphabetically by field SecondName (inside 1st level sort model) and additionally for all elements having same value of SecondName could be sorted by filed FirstName (inside 2nd level sort model).

    I'm not sure if it wolud be clear enough :-)



  • 3.  RE: Configurable Collection Sort - eh?

    Posted Oct 31, 2011 07:54 AM

    AnaMan,

    Thanks for the explanation, but I was hoping for a couple of diagrams to illustrate how to connect up the Embedded Decision Model. It is not self-explanatory:

    Kindest regards,

    QuietLeni



  • 4.  RE: Configurable Collection Sort - eh?
    Best Answer

    Posted Nov 02, 2011 06:25 AM

    OK, so below you can find several simple screenshots.

     

    Sort model in my example is implemented with Text Compare Rule component.

    Notice that I changed the order of outputs to avoid crossing component links.



  • 5.  RE: Configurable Collection Sort - eh?

    Posted Nov 02, 2011 11:53 AM

    AnaMan,

    Thanks for that one. That was what I thought might be the process, but it seemed not to work. I will have to revist this one again.

    Kindest regards,

    QuietLeni