Skip to main content



GetLastValue Function

Returns the specified field value of last member of collection which can be sorted and filtered. In case of failed lookup, a default value must be specified.

Syntax 1

GetLastValue(collection, returnField, defaultReturnValue)

Returns the specified field value of last member of collection which can be sorted and filtered. In case of failed lookup, a default value must be specified.

Arguments

collection Collection - A collection.

returnField Field - The field with the value to return.

defaultReturnValue Any - Default value of type of return field.

Syntax 2

GetLastValue(collection, returnField, defaultReturnValue, orderby)

Returns the specified field value of last member of collection which can be sorted and filtered. In case of failed lookup, a default value must be specified.

Arguments

collection Collection - A collection.

returnField Field - The field with the value to return.

defaultReturnValue Any - Default value of type of return field.

orderby SortExpression - Field to order by.

Syntax 3

GetLastValue(collection, returnField, defaultReturnValue, orderby, filter)

Returns the specified field value of last member of collection which can be sorted and filtered. In case of failed lookup, a default value must be specified.

Arguments

collection Collection - A collection.

returnField Field - The field with the value to return.

defaultReturnValue Any - Default value of type of return field.

orderby SortExpression - Field to order by.

filter FilterExpression - A filter expression.

Remarks

Example:

GetLastValue(LineItems, Quantity, 1); // returns 42

Example:

GetLastValue(LineItems, Quantity, 1, ProductID, UnitPrice > 10); // returns 42