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"}