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 |
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: |
Optional |
sortValues : string | If @by=”property”, you can specify @sortValues to define the ordering of values to be sorted.
e.g. |
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 |
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>