語法
Table.AddKey(
table as table,
columns as list,
isPrimary as logical
) as table
關於
將索引鍵新增至 table,其中 columns 是定義索引鍵的資料行名稱清單,而且 isPrimary 會指定該索引鍵是否為主索引鍵。
範例 1
新增一個單欄主鍵至資料表。
使用方式
let
table = Table.FromRecords({
[Id = 1, Name = "Hello There"],
[Id = 2, Name = "Good Bye"]
}),
resultTable = Table.AddKey(table, {"Id"}, true)
in
resultTable
輸出
Table.FromRecords({
[Id = 1, Name = "Hello There"],
[Id = 2, Name = "Good Bye"]
})