LogCore Arrays

Any

Syntax:

Any(array[])

Returns true if there are one or more elements in the array[].

Array

Parameters:
NameTypeDescription
array[]json arrayThe array to be checked.
Returns:

bool

Any($.Courses[*])

Avg

Syntax:

Avg(array[])

Returns the average of the elements in the array[].

Array

Parameters:
NameTypeDescription
array[]json arrayThe array of numbers to be averaged.
Returns:

decimal

Avg($.Courses[*].Price)

ChunkBy

Syntax:

ChunkBy(array[], size)

Chunks the elements in the array[] into batches of the provided size.

Array

Parameters:
NameTypeDescription
array[]json arrayThe array to be chunked.
sizeintThe size of each chunk.
Returns:

ChunkBy($.Courses[*], 5)

Count

Syntax:

Count(array[])

Returns the number of elements in the array[].

Array

Parameters:
NameTypeDescription
array[]json arrayThe array whose elements are to be counted.
Returns:

int

Count($.Courses[*])

Distinct Count

Syntax:

DCount(array[])

Returns the distinct number of elements in the array[].

Array

Parameters:
NameTypeDescription
array[]json arrayThe array whose distinct elements are to be counted.
Returns:

int

DCount($.Courses[*])

Empty

Syntax:

Empty(param1)

Returns true if param1 is null or empty.

Array

Parameters:
NameTypeDescription
param1stringThe string to be checked.
Returns:

bool

Empty(”)
Returns `true`.

First

Syntax:

First(array[])

Returns the first element in the array[].

Array

Parameters:
NameTypeDescription
array[]json arrayThe array from which the first element is to be returned.
Returns:

object

First($.Courses)

First

Syntax:

First(array[], param1, selector)

Returns the first element in the array[] that matches the filter expression and returns the object or value of the selector expression.

Array

Parameters:
NameTypeDescription
array[]json arrayThe array to be searched.
param1stringThe filter expression.
selectorstringThe selector expression.
Returns:

object

First($.Courses[*], @.Name = ‘Maths’)
First($.Courses[*], @.Name = ‘Maths’).id

GroupBy

Syntax:

GroupBy(array[], selector)

Groups the elements in the array[] by the selector.

Array

Parameters:
NameTypeDescription
array[]json arrayThe array to be grouped.
selectorstringThe property to group by.
Returns:

object: {‘Key’:123, ‘Group’:[]}

GroupBy($.Courses, ‘Category’)

In

Syntax:

In(array[], param1)

Returns true if param1 is in the array[].

Array

Parameters:
NameTypeDescription
array[]json arrayThe array to be searched.
param1objectThe object to be checked.
Returns:

bool

In(‘Maths’, $.Courses[*].Name)

IsEmpty

Syntax:

IsEmpty(array[], param2)

Returns the original array if it is not empty. If the array is empty, returns the specified return value.

Array

Parameters:
NameTypeDescription
array[]arrayThe array to be evaluated for emptiness
param2objectThe value to be returned if the array is empty
Returns:

array or object

IsEmpty([], ‘Array is empty’)
Returns `’Array is empty’` if the input array is empty.

IsEmpty([‘Course 1’, ‘Course 2’], ‘Array is empty’)
Returns `[‘Course 1’, ‘Course 2’]` if the input array is not empty.

Join

Syntax:

Join(array[], param2)

Joins the elements in the array[] using param2 as the separator and returns a string.

Array

Parameters:
NameTypeDescription
array[]json arrayThe array of strings to be joined.
param2string(Optional) The separator string.
Returns:

string

Join($.Courses[*].Name, ‘, ‘)

Last

Syntax:

Last(array[])

Returns the last element in the array[].

Array

Parameters:
NameTypeDescription
array[]json arrayThe array from which the last element is to be returned.
Returns:

object

Last($.Courses)

Last

Syntax:

Last(array[], param1, selector)

Returns the last element in the array[] that matches the filter expression and returns the object or value of the selector expression.

Array

Parameters:
NameTypeDescription
array[]json arrayThe array to be searched.
param1stringThe filter expression.
selectorstringThe selector expression.
Returns:

object

Last($.Courses[*], @.Name = ‘Maths’)
Last($.Courses[*], @.Name = ‘Maths’).id

Max

Syntax:

Max(array[])

Returns the largest element in the array[].

Array

Parameters:
NameTypeDescription
array[]json arrayThe array from which the maximum value is to be returned.
Returns:

object

Max($.Courses[*].Price)

Min

Syntax:

Min(array[])

Returns the smallest element in the array[].

Array

Parameters:
NameTypeDescription
array[]json arrayThe array from which the minimum value is to be returned.
Returns:

object

Min($.Courses[*].Price)

Sum

Syntax:

Sum(array[])

Returns the sum of the elements in the array[].

Array

Parameters:
NameTypeDescription
array[]json arrayThe array of numbers to be summed.
Returns:

decimal

Sum($.Courses[*].Price)

ToArray

Syntax:

ToArray(param1, param2, param3, ...)

Converts param1, param2, param3, … into an array.

Array

Parameters:
NameTypeDescription
param1objectThe first element of the array.
param2objectThe second element of the array.
param3objectThe third element of the array.
objectAdditional elements of the array.
Returns:

array

ToArray(1, 2, 3)