Skip to main content

Table.RemoveLastN

Returnează un tabel cu ultimele N rânduri eliminate.

Syntax

Table.RemoveLastN(
table as table,
optional countOrCondition as any
) as table

Remarks

Returnează un tabel care nu conține ultimele countOrCondition rânduri din tabelul table. Numărul de rânduri eliminate depinde de parametrul opțional countOrCondition.

  • Dacă countOrCondition este omis, numai ultimul rând este eliminat.
  • Dacă countOrCondition este un număr, se va elimina numărul respectiv de rânduri (începând de la final).
  • Dacă countOrCondition este o condiție, rândurile care îndeplinesc condiția vor fi eliminate până când un rând nu îndeplinește condiția.

Examples

Example #1

Eliminați ultimul rând al tabelului.

Table.RemoveLastN(
Table.FromRecords({
[CustomerID = 1, Name = "Bob", Phone = "123-4567"],
[CustomerID = 2, Name = "Jim", Phone = "987-6543"],
[CustomerID = 3, Name = "Paul", Phone = "543-7890"],
[CustomerID = 4, Name = "Ringo", Phone = "232-1550"]
}),
1
)

Result:

Table.FromRecords({
[CustomerID = 1, Name = "Bob", Phone = "123-4567"],
[CustomerID = 2, Name = "Jim", Phone = "987-6543"],
[CustomerID = 3, Name = "Paul", Phone = "543-7890"]
})

Example #2

Eliminați ultimele rânduri din tabel în care [IDClient] > 2.

Table.RemoveLastN(
Table.FromRecords({
[CustomerID = 1, Name = "Bob", Phone = "123-4567"],
[CustomerID = 2, Name = "Jim", Phone = "987-6543"],
[CustomerID = 3, Name = "Paul", Phone = "543-7890"],
[CustomerID = 4, Name = "Ringo", Phone = "232-1550"]
}),
each [CustomerID] >= 2
)

Result:

Table.FromRecords({[CustomerID = 1, Name = "Bob", Phone = "123-4567"]})

Category

Table.Row operations