Part I. Getting started

Part II. UML modeling

Part III. Project glossary

Part IV. BPMN toolset

Part V. Project management

Part VI. Modeling toolset

Part VII. ArchiMate tools

Part VIII. Team collaboration

Part IX. Code engineering

Part X. Database design and engineering

Part XI. Advanced modeling toolset

Part XII. Document production

Part XIII. Business modeling

Part XIV. Business rule

Part XV. Agile development

Part XVI. Wireframe

Part XVII. Impact analysis

Part XVIII. CMMN toolset

Part XIX. SoaML modeling

Part XX. Design animation

Part XXI. IDE Integration

Part XXII. Interoperability and integration

Part XXIII. Process simulation

Part XXIV. Zachman and BMM

Part XXV. Appendix A - Application Options

Part XXVI. Appendix B - Project Options

Part XXVII. Appendix C

 

Sorting in Loop

Add <Sortings> under a loop element (e.g. <IterationBlock>, <ForEach>) to sort retrieved elements. <Sortings> contains one or more <Sorting>. Each <Sorting> defines a way to sort the elements retrieved. The following example show the use of <Sorting> in a template.

<IterationBlock modelType="class">
    <Sortings>
        <Sorting by="property" property="name"/>
    </Sortings>
    <Property property="name"/>
    <ParagraphBreak/>
</IterationBlock>

Here is the outcome of the example above.

Account
AccountController
AccountManager
Transaction
User

The following table lists the available attributes of <Sorting>.

Name Description/Usage Required?
by : string

{name | type | modelType | diagramType | property | followTree | level | businessProcessFlow}
Sort by any of the following options:

- name : sort by name
- type : sort by type (type of model element or diagram)
- modelType : sort by model element's type
- diagramType : sort by diagram type
- property: sort by property, requires the definition of @property, @sortValues, @defaultPropertyValue
- followTree: sort following how elements are being sorted in Model Navigator and Diagram Navigator
- level: sort by parent-child
- businessProcessFlow:
  sorting the BPD elements by the ordering in BPD (calculated by their ordering in sequence/message flow).
  ONLY AVIALABLE for sorting Diagram Elements in a BPD
Required
property : string
If @by="property", you have to specify @property to specify the property to be sorted.

You can also sort elements by their tagged values by specifying this:
${taggedValues.children(TAG_NAME).value}
Replace TAG_NAME with the name of the tag to be sorted
Optional
sortValues : string If @by="property", you can specify @sortValues to define the ordering of values to be sorted.

e.g.
   @by="property" @property="visibility" @sortValues="public, protected, private"
   means 'public' model elements will list before 'protected' model elements, 'protected' will list before 'private'
Optional
defaultPropertyValue : string If  @by="property", @defaultPropertyValue can be specified for the default value of the model elements that don't have this property value. Optional
descending : boolean Sorting in descending order. Optional
dateFormatString : string Date value property will be formatted with the format pattern specified before sorting. Formatting will only occur when the property is a date value (e.g. pmLastModified).

e.g. @dateFormatString ="yyyy-MM-dd"
Optional
Attributes of <Sorting>

Suppress the default way of sorting

Without using <Sortings> and <Sorting>, elements in loop will still be sorted alphabetically. If you want to suppress the default way of sorting, write <Sortings noSort="true"/>. Here is an example:

<IterationBlock modelType="class">
    <Sortings noSort="true"/>
    <Property property="name"/>
    <ParagraphBreak/>
</IterationBlock>

Related Resources

The following resources may help you to learn more about the topic discussed in this page.

 
5. Looping (Connector) Table of Contents 7. Conditional Expression

We use cookies to offer you a better experience. By visiting our website, you agree to the use of cookies as described in our Cookie Policy.OK