跳至主要内容

Table.MatchesAllRows

指出資料表中的所有資料列是否都符合指定的條件。

Syntax

Table.MatchesAllRows(
table as table,
condition as function
) as logical

Remarks

指出 table 中的所有資料列是否都符合指定的 condition。如果所有資料列都符合,則傳回 true,否則傳回 false

Examples

Example #1

判斷資料表中 [a] 資料行的所有資料列值是否都是偶數。

Table.MatchesAllRows(
Table.FromRecords({
[a = 2, b = 4],
[a = 6, b = 8]
}),
each Number.Mod([a], 2) = 0
)

Result:

true

Example #2

找出資料表 ({[a = 1, b = 2], [a = 3, b = 4]}) 中所有資料列值是否都是 [a = 1, b = 2]。

Table.MatchesAllRows(
Table.FromRecords({
[a = 1, b = 2],
[a = -3, b = 4]
}),
each _ = [a = 1, b = 2]
)

Result:

false

Category

Table.Row operations