Aller au contenu principal

Table.HasColumns

Indique si la table contient les colonnes spécifiées.

Syntax

Table.HasColumns(
table as table,
columns as any
) as logical

Remarks

Indique si table contient les colonnes spécifiées, columns. Renvoie true si la table contient les colonnes, sinon false.

Examples

Example #1

Détermine si la table a la colonne [Name].

Table.HasColumns(
Table.FromRecords({
[CustomerID = 1, Name = "Bob", Phone = "123-4567"],
[CustomerID = 2, Name = "Jim", Phone = "987-6543"],
[CustomerID = 3, Name = "Paul", Phone = "543-7890"],
[CustomerID = 4, Name = "Ringo", Phone = "232-1550"]
}),
"Name"
)

Result:

true

Example #2

Détermine si la table a les colonnes [Name] et [PhoneNumber].

Table.HasColumns(
Table.FromRecords({
[CustomerID = 1, Name = "Bob", Phone = "123-4567"],
[CustomerID = 2, Name = "Jim", Phone = "987-6543"],
[CustomerID = 3, Name = "Paul", Phone = "543-7890"],
[CustomerID = 4, Name = "Ringo", Phone = "232-1550"]
}),
{"Name", "PhoneNumber"}
)

Result:

false

Category

Table.Column operations