Saltar al contenido principal

Table.AddKey

Agrega una clave a una tabla.

Syntax

Table.AddKey(
table as table,
columns as list,
isPrimary as logical
) as table

Remarks

Agregar una clave a table, dondecolumns es la lista de nombres que define la clave, y isPrimary especifica si la clave es la principal.

Examples

Example #1

Agregue una clave principal de una sola columna a una tabla.

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

Result:

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

Category

Table.Transformation