Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Warning

Looking for the documentation on the newest versions of SIL Engine and the Simple Issue Language for Jira 8 for Server/Data Center? Click here !

Info
titleAvailability

This routine is available since katl-commons starting with SIL Engine™ 3.0.1.

Syntax

...

arrayStructSort(arr, field)

Description

...

Excerpt

Sorts the elements from an array by their specified field. Works only with arrays that contain structures.

Parameters

...

Parameter name

Type

Required

Description

arr

array

Yes

The arrayArray, must be a struct array.

fieldstringYesThe field Field to be sorted by.

Return Type

array

Example

Code Block
struct Person {
    string id;
    string name;
}


Person p1; 
p1.name = "John Doe";
p1.id = "1234567";

Person p2; 
p2.name = "Jane Doe";
p2.id = "1234568";

Person p3; 
p3.name = "Jimmy Doe";
p3.id = "1234565";

Person[] persons = {p1, p2, p3};

runnerLog("Array before sort:

...

array

See Also:

...

 " + persons);

persons = arrayStructSort(persons, "id");

runnerLog("Array after sort: " + persons);

The output will be:

Array before sort: 1234567|John Doe|1234568|Jane Doe|1234565|Jimmy Doe
Array after sort: 1234565|Jimmy Doe|1234567|John Doe|1234568|Jane Doe

See also

Filter by label (Content by label)
showLabelsfalse
max100
showSpacefalse
cqllabel = "array_routines"
labelsarray_routines