Læs på engelsk

Del via


Table.HasColumns

Syntaks

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

Omtrent

Angiver, om table indeholder de angivne kolonner columns. Returnerer true, hvis tabellen indeholder kolonnerne, false ellers.

Eksempel 1

Find ud af, om tabellen har kolonnen [Name].

brug

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

output

true

Eksempel 2

Find ud af, om tabellen har kolonnen [Name] og [PhoneNumber].

brug

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

output

false