Table.ReplaceKeys

Składnia

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

Około

Zastępuje klucze określonej tabeli.

Przykład

Zastąp istniejące klucze tabeli.

użycie

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]}),
    newKeys = Table.Keys(resultTable)
in
    newKeys

Wyjście

{[Columns = {"Id"}, Primary = false]}