Nhảy tới nội dung

Table.ReplaceKeys

Thay thế các khóa của bảng được chỉ định.

Syntax

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

Remarks

Thay thế các khóa của bảng được chỉ định.

Examples

Example #1

Thay thế các khóa hiện có của bảng.

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

Result:

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

Category

Table.Transformation