Partager via


Table.HasColumns

Syntaxe

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

À propos de

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

Exemple 1

Déterminez si la table contient la colonne [Name].

Utilisation

TTable.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"
)

Sortie

true

Exemple 2

Déterminez si la table contient les colonnes [Name] et [PhoneNumber].

Utilisation

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"}
)

Sortie

false