Table.Contains
Syntaxe
Table.Contains(table as table, row as record, optional equationCriteria as any) as logical
À propos
Indique si l’enregistrement spécifié, row
, s’affiche sous la forme d’une ligne dans table
. Vous pouvez spécifier un paramètre facultatif equationCriteria
pour contrôler la comparaison entre les lignes de la table.
Exemple 1
Déterminer si la table contient la ligne.
Utilisation
Table.Contains(
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 = "Bob"]
)
Sortie
true
Exemple 2
Déterminer si la table contient la ligne.
Utilisation
Table.Contains(
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 = "Ted"]
)
Sortie
false
Exemple 3
Déterminer si la table contient la ligne en comparant seulement la colonne [Name].
Utilisation
Table.Contains(
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"]
}),
[CustomerID = 4, Name = "Bob"],
"Name"
)
Sortie
true