Table.PositionOf

Table.PositionOf

Returns the position or positions of the row within the table.

function (table as table, row as record, optional occurrence as nullable any, optional equationCriteria as nullable any) as nullable any

Description

Returns the row position of the first occurrence of the row in the table specified. Returns -1 if no occurrence is found.

Category

Table.Membership

Examples

Find the position of the first occurrence of [a = 2, b = 4] in the table ({[a = 2, b = 4], [a = 6, b = 8], [a = 2, b = 4], [a = 1, b = 4]}).

Table.PositionOf(Table.FromRecords({[a = 2, b = 4], [a = 1, b = 4], [a = 2, b = 4], [a = 1, b = 4]}), [a = 2, b = 4])

0

Find the position of the second occurrence of [a = 2, b = 4] in the table ({[a = 2, b = 4], [a = 6, b = 8], [a = 2, b = 4], [a = 1, b = 4]}).

Table.PositionOf(Table.FromRecords({[a = 2, b = 4], [a = 1, b = 4], [a = 2, b = 4], [a = 1, b = 4]}), [a = 2, b = 4], 1)

2

Find the position of all the occurrences of [a = 2, b = 4] in the table ({[a = 2, b = 4], [a = 6, b = 8], [a = 2, b = 4], [a = 1, b = 4]}).

Table.PositionOf(Table.FromRecords({[a = 2, b = 4], [a = 1, b = 4], [a = 2, b = 4], [a = 1, b = 4]}), [a = 2, b = 4], Occurrence.All)

{0, 2}