Table.FromRecords
Table.FromRecords(records as list, optional columns as any, optional missingField as nullable number) as table
将记录列表 records
转换为表。
使用记录字段名称作为列名称,通过记录创建表。
使用情况
Table.FromRecords({
[CustomerID = 1, Name = "Bob", Phone = "123-4567"],
[CustomerID = 2, Name = "Jim", Phone = "987-6543"],
[CustomerID = 3, Name = "Paul", Phone = "543-7890"]
})
输出
Table.FromRecords({
[CustomerID = 1, Name = "Bob", Phone = "123-4567"],
[CustomerID = 2, Name = "Jim", Phone = "987-6543"],
[CustomerID = 3, Name = "Paul", Phone = "543-7890"]
})
使用键入的列通过记录创建表并选择数字列。
使用情况
Table.ColumnsOfType(
Table.FromRecords(
{[CustomerID = 1, Name = "Bob"]},
type table[CustomerID = Number.Type, Name = Text.Type]
),
{type number}
)
输出
{"CustomerID"}