Table.PositionOfAny
语法
Table.PositionOfAny(table as table, rows as list, optional occurrence as nullable number, optional equationCriteria as any) as any
关于
返回 rows
列表第一个匹配项在 table
中的行位置。 如果未找到匹配项,则返回 -1。
table
:输入表。rows
:表中要查找其位置的行的列表。occurrence
:[可选] 指定要返回的行的匹配项。- `equationCriteria:[可选] 控制表行之间的比较。
示例 1
查找 [a = 2, b = 4] 或 [a = 6, b = 8] 在表 ({[a = 2, b = 4], [a = 6, b = 8], [a = 2, b = 4], [a = 1, b = 4]})
中第一次出现的位置。
使用情况
Table.PositionOfAny(
Table.FromRecords({
[a = 2, b = 4],
[a = 1, b = 4],
[a = 2, b = 4],
[a = 1, b = 4]
}),
{
[a = 2, b = 4],
[a = 6, b = 8]
}
)
输出
0
示例 2
查找 [a = 2, b = 4] 或 [a = 6, b = 8] 在表 ({[a = 2, b = 4], [a = 6, b = 8], [a = 2, b = 4], [a = 1, b = 4]}
中所有出现的位置。
使用情况
Table.PositionOfAny(
Table.FromRecords({
[a = 2, b = 4],
[a = 6, b = 8],
[a = 2, b = 4],
[a = 1, b = 4]
}),
{
[a = 2, b = 4],
[a = 6, b = 8]
},
Occurrence.All
)
输出
{0, 1, 2}