Table.Split
Table.Split(table as table,pageSize as number) as list
将 table
拆分为一系列表,其中列表的第一个元素是包含源表中前 pageSize
个元素的表,
列表的下一个元素是包含源表中接下来 pageSize
个元素的表,以此类推。
示例:
将包含五条记录的表拆分为各含两条记录的表。
使用情况:
let
Customers = 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 = "Cristina", Phone = "232-1550"],
[CustomerID = 5, Name = "Anita", Phone = "530-1459"]
})
in
Table.Split(Customers, 2)
输出:
{
Table.FromRecords({
[CustomerID = 1, Name = "Bob", Phone = "123-4567"],
[CustomerID = 2, Name = "Jim", Phone = "987-6543"]
}),
Table.FromRecords({
[CustomerID = 3, Name = "Paul", Phone = "543-7890"],
[CustomerID = 4, Name = "Cristina", Phone = "232-1550"]
}),
Table.FromRecords({
[CustomerID = 5, Name = "Anita", Phone = "530-1459"]
})
}