Udostępnij za pośrednictwem


Table.IsDistinct

Składnia

Table.IsDistinct(table as table, optional comparisonCriteria as any) as logical  

Informacje

Wskazuje, czy zawiera table tylko odrębne wiersze (bez duplikatów). Zwraca wartość true , jeśli wiersze są odrębne, false w przeciwnym razie. Opcjonalny parametr comparisonCriteriaokreśla, które kolumny tabeli są testowane pod kątem duplikowania. Jeśli comparisonCriteria nie zostanie określony, wszystkie kolumny zostaną przetestowane.

Przykład 1

Ustal, czy tabela jest odrębna.

Użycie

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

Wyjście

true

Przykład 2

Ustal, czy tabela jest odrębna w kolumnie.

Użycie

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

Wyjście

false