Choose where you’d like to start

Sort

Overview

The sort deluge task sorts the elements of a list, in an ascending order if the specified boolean value is true, or in descending order if the specified boolean value is false.

The boolean value is not mandatory. If it is not specified, the elements are sorted in an ascending order.

Note

  • In a string list, special characters, upper case, and lower case letters are sorted in the following order: 
    ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ <capital letters> [ ] ^ _ ` <small letters> { | } ~​

Return

  • List

Syntax

<variable> = <list>.sort(<boolean_value>);
ParameterDescription

<variable>

(optional)

Variable which will contain the returned list.
<list>

The list variable whose elements will be sorted.

If the list contains elements of different data types, the function will return null.

Data type is List.  

<boolean_value>

Applicable values are: true or false.

Data type is Boolean.

This task can be used in the following events

When a record is Created
On LoadYes
On ValidateYes
On SuccessYes
On User inputYes
Subform on add rowYes
Subform on delete rowYes
When a record is Created or Edited
On LoadYes
On ValidateYes
On SuccessYes
On User inputYes
Subform on add rowYes
Subform on delete rowYes
When a record is Edited
On LoadYes
On ValidateYes
On SuccessYes
On User inputYes
Subform on add rowYes
Subform on delete rowYes
When a record is Deleted
On ValidateYes
On SuccessYes
Other workflow events
On a scheduled dateYes
During approval processYes
During payment processYes
In a Custom FunctionYes
In an Action item in reportYes

Example

Let's say we have a list variable "colors" which contains the values {"red", "blue", "green", "yellow"}

The first and second snippets shown below will sort these elements in ascending order. The third snippet will sort the elements in descending order.

 colors.sort(); 
 colors.sort(true);
 colors.sort(false);

Get Started Now

Execute