Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Syntax
List.ContainsAny(
list as list,
values as list,
optional equationCriteria as any
) as logical
About
Indicates whether the list contains any of the values from another list. Returns true if the values are found in the list, false otherwise.
list: The list to search.values: The list of values to search for in the first list.equationCriteria: (Optional) The comparer used to determine if two values are equal.
Example 1
Determine if the list {1, 2, 3, 4, 5} contains 3 or 9.
Usage
List.ContainsAny({1, 2, 3, 4, 5}, {3, 9})
Output
true
Example 2
Determine if the list {1, 2, 3, 4, 5} contains 6 or 7.
Usage
List.ContainsAny({1, 2, 3, 4, 5}, {6, 7})
Output
false
Example 3
Determine if the list contains a horse or an owl, while ignoring case.
Usage
List.ContainsAny({"dog", "cat", "racoon", "horse", "rabbit"}, {"Horse", "OWL"}, Comparer.OrdinalIgnoreCase)
Output
true
Example 4
Determine if the list contains a date of either April 8, 2022 or January 12, 2021.
Usage
let
Source = {#date(2024, 2, 23), #date(2023, 12, 2), #date(2022, 4, 8), #date(2021, 7, 6)},
ContainsDates = List.ContainsAny(Source, {Date.From("Apr 8, 2022"), Date.From("Jan 11, 2021")})
in
ContainsDates
Output
true