Table.ReplaceKeys

構文

Table.ReplaceKeys(table as table, keys as list) as table

詳細

指定したテーブルのキーを置き換えます。

例 1

テーブルの既存のキーを置き換えます。

使用方法

let
    table = Table.FromRecords({
        [Id = 1, Name = "Hello There"],
        [Id = 2, Name = "Good Bye"]
    }),
    tableWithKeys = Table.AddKey(table, {"Id"}, true),
    resultTable = Table.ReplaceKeys(tableWithKeys, {[Columns = {"Id"}, Primary = false]})
in
    resultTable

出力

Table.FromRecords({
    [Id = 1, Name = "Hello There"],
    [Id = 2, Name = "Good Bye"]
})