Table.HasColumns

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

指示 table 是否包含指定的列 columns。如果表包含此列或这些列,则返回 true;否则返回 false

示例:

确定表是否具有列 [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")

输出:

true

示例:

查找表是否具有列 [Name] 和 [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"})

输出:

false

results matching ""

    No results matching ""