GetFirstValue Function
Returns the specified field value of first member of collection which can be sorted and filtered. In case of failed lookup, a default value must be specified.
Syntax 1
GetFirstValue(collection, returnField, defaultReturnValue)
Returns the specified field value of first 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
GetFirstValue(collection, returnField, defaultReturnValue, orderby)
Returns the specified field value of first 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
GetFirstValue(collection, returnField, defaultReturnValue, orderby, filter)
Returns the specified field value of first 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:
GetFirstValue(LineItems, Quantity, 1); // returns 42
Example:
GetFirstValue(LineItems, Quantity, 1, ProductID, UnitPrice > 10); // returns 42