Lewati ke konten utama

Table.RemoveFirstN

Menghasilkan tabel dengan baris hitungan pertama dilewati.

Syntax

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

Remarks

Mengembalikan tabel yang tidak berisi jumlah baris yang ditetapkan pertama, countOrCondition, pada tabel table. Jumlah baris yang dihapus akan tergantung pada parameter opsional countOrCondition.

  • Jika countOrCondition dihilangkan, hanya baris pertama yang dihapus.
  • Jika countOrCondition adalah angka, baris sebanyak itu (dimulai dari atas) akan dihapus.
  • Jika countOrCondition adalah kondisi, baris yang memenuhi kondisi tersebut akan dihapus hingga baris yang tidak memenuhi kondisi ditemukan.

Examples

Example #1

Menghapus baris pertama dalam tabel.

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

Menghapus dua baris pertama dalam tabel.

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

Menghapus baris pertama dengan [CustomerID] <= 2 dari tabel.

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