PowerApps 中的 First、FirstN、Last 和 LastN 函数First, FirstN, Last, and LastN functions in PowerApps

返回表中的第一组或最后一组记录Returns a table's first or last set of records.

说明Description

First 函数返回中的第一条记录。The First function returns the first record of a table.

FirstN 函数返回表中的第一组记录,第二个参数指定要返回的记录数。The FirstN function returns the first set of records of a table; the second argument specifies the number of records to return.

Last 函数返回表中的最后一条记录。The Last function returns the last record of a table.

LastN 函数返回表中的最后一组记录,第二个参数指定要返回的记录数。The LastN function returns the last set of records of a table; the second argument specifies the number of records to return.

FirstLast 都返回单个记录。First and Last return a single record. FirstNLastN 都返回一个表,即使仅指定了单个记录。FirstN and LastN return a table, even if you specify only a single record.

When used with a data source, these functions can't be delegated. Only the first portion of the data source will be retrieved and then the function applied. The result may not represent the complete story. A blue dot will appear at authoring time to remind you of this limitation and to suggest switching to delegable alternatives where possible. For more information, see the delegation overview.

语法Syntax

First( Table )First( Table )
Last( Table )Last( Table )

  • Table - 必需。Table - Rquired. 要运算的表。Table to operate on.

FirstN( Table [, NumberOfRecords ] )FirstN( Table [, NumberOfRecords ] )
LastN( Table [, NumberOfRecords ] )LastN( Table [, NumberOfRecords ] )

  • Table - 必需。Table - Required. 要运算的表。Table to operate on.
  • NumberOfRecords - 可选。NumberOfRecords - Optional. 要返回的记录数。Number of records to return. 如果未指定此参数,函数将返回一条记录。If you don't specify this argument, the function returns one record.

示例Examples

此公式返回名为 Employees 的表中的第一条记录:This formula returns the first record from a table named Employees:
First(Employees) First(Employees)

此公式返回名为 Employees 的表中的最后 15 条记录:This formula returns the last 15 records from a table named Employees:
LastN(Employees, 15) LastN(Employees, 15)