Last
The Last()
function returns the last item in a list or concept set.
For (persistent) lists it now also accepts a list as parameter - only to be used in Kubernetes Runtime 4.2 (not in Shared Europe, Shared APAC or any private runtime 4.1.xxx).
This function is NOT SQL compatible. For more information about SQL compatibility, see our documentation.
Returns the last item in the given list
or concept_set
.
Returns Unknown
if one of the parameter values is unknown or outside the common valid date boundaries.
Possible fault message in expression editor: Invalid call to a function: parameter mismatch at position(x,y): Last
This could mean that there is no field of list used, but only the (reference to a) list.
For Runtimes Shared EUR, Shared APAC and Private Clouds v4.1.xx, the Last function needs a field from list where filter construction, or if you only want to get the last row of a list, use RowId([list]) of [list] where [filter]
.
For Runtimes 4.2, the Last function now also accepts a List as parameter - no longer requiring a specific field.
First() and Last() on a database list use the RowID for standard sorting - so:
First([Name] of [Products])
will get the name-fieldvalue of the first item created, and
Last([Name] of [Products])
will get the name-fieldvalue of the last item created.
You can limit/specify the resultlist using the WHERE options, and within that resultlist, the lowest or highest RowID will be returned.
In future we will add the [Order By] syntax to WEM Expressions, so you can specify the order yourself in the expression, and then the First and Last will use that sorting.
In some specific cases if you want the First/Last item based on another fieldvalue, like LastModified, you could use something like
Last([name] of [List] WHERE [LastModified] = Max([LastModified] of [List]))
Syntax
Parameters
values
list or a concept_set
☑️
a collection of values or elements of the same type, or a list of fields from a (persistent) list.
Last updated
Was this helpful?