Saltar al contenido principal

Table.RemoveFirstN

Devuelve una tabla con las primeras filas de recuentos omitidas.

Syntax

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

Remarks

Devuelve una tabla que no contiene el primer número de filas especificado (countOrCondition) de la tabla table. El número de filas quitadas depende del parámetro opcional countOrCondition.

  • Si se omite countOrCondition, solo se quita la primera fila.
  • Si countOrCondition es un número, se quitarán esas filas (empezando por la parte superior).
  • Si countOrCondition es una condición, se quitarán las filas que la cumplan hasta que una no lo haga.

Examples

Example #1

Quitar la primera fila de la tabla.

Table.RemoveFirstN(
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 = 2, Name = "Jim", Phone = "987-6543"],
[CustomerID = 3, Name = "Paul", Phone = "543-7890"],
[CustomerID = 4, Name = "Ringo", Phone = "232-1550"]
})

Example #2

Quitar las dos primeras filas de la tabla.

Table.RemoveFirstN(
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"]
}),
2
)

Result:

Table.FromRecords({
[CustomerID = 3, Name = "Paul", Phone = "543-7890"],
[CustomerID = 4, Name = "Ringo", Phone = "232-1550"]
})

Example #3

Quitar las primeras filas donde [CustomerID] <=2 de la tabla.

Table.RemoveFirstN(
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 = 3, Name = "Paul", Phone = "543-7890"],
[CustomerID = 4, Name = "Ringo", Phone = "232-1550"]
})

Category

Table.Row operations