last

Returns the last (or several last) items in a list.

Function

result = last([count], input)

Arguments

ArgumentData Type
countinteger
inputlist
resultlist or single value of the input list's item type

Comments

The default value for count is 1. Returns the last count records of the input list as a list of values if count is greater than 1; if count is equal to 1 then the return type is a single value of the same type as the input list's values.

This function is usually used with ordering to return a meaningful output. An example of this is shown below.

Examples

result = last([Direct Reports])
result = last(2, [Direct Reports])
result = last([Direct Reports] order by [Name])