Table.IsDistinct
语法
Table.IsDistinct(table as table, optional comparisonCriteria as any) as logical
关于
指示 table
是否仅包含非重复行(没有重复项)。 如果行是唯一的,则返回 true
;否则返回 false
。 可选参数 comparisonCriteria
指定对表中的哪些列进行测试以确定是否有重复项。 如果未指定 comparisonCriteria
,则测试所有列。
示例 1
确定表是否为非重复表。
使用情况
Table.IsDistinct(
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"]
})
)
输出
true
示例 2
确定表中的列是否非重复。
使用情况
Table.IsDistinct(
Table.FromRecords({
[CustomerID = 1, Name = "Bob", Phone = "123-4567"],
[CustomerID = 2, Name = "Jim", Phone = "987-6543"],
[CustomerID = 3, Name = "Paul", Phone = "543-7890"],
[CustomerID = 5, Name = "Bob", Phone = "232-1550"]
}),
"Name"
)
输出
false