Order the elements of a variable of array type.
1 array.sort
<array.sort name='name'>
<array /> ?
</array.sort>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Aname | string | Name of the variable of the array type. |
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Earray | array | The array object can be referenced by name using the attribute name or it can be passed as an argument of the function. |
Returns | |
---|---|
Type | Description |
Array | Returns the updated list (ordered). |
Example
Order an array.
Copy
<xsql-script name='array_sort_test1'> <body> <array name='cities'> <string>Paris</string> <string>Rome</string> <string>Barcelona</string> </array> <array.sort name='cities' /> <println><cities/></println> </body> </xsql-script>
An alternative to obtain the ordered cities (alphabetically) which contain the variable, but egally valid, would be:
Copy
<array.sort><cities/></array.sort>
The result is:
Copy
Barcelona Paris Rome