Skip to main content

Table.Contains

Nurodoma, ar nurodytas įrašas lentelėje rodomas kaip eilutė.

Syntax

Table.Contains(
table as table,
row as record,
optional equationCriteria as any
) as logical

Remarks

Nurodoma, ar nurodytas įrašas row lentelėje table rodomas kaip eilutė. Galima nurodyti pasirenkamą parametrą equationCriteria, norint valdyti lentelės eilučių palyginimą.

Examples

Example #1

Nustatykite, ar lentelėje yra eilutė.

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

Result:

true

Example #2

Nustatykite, ar lentelėje yra eilutė.

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

Result:

false

Example #3

Nustatykite, ar lentelėje yra eilutė, lygindami tik stulpelį [Name].

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

Result:

true

Category

Table.Membership