How to do a duplicate search?

I have a table:

Position | Parent position

ZDIR | DIR
RD | ZDIR
NO | RD
MS | NO

I know the position. I need to get a list of all the parent positions. For example, I know the position NO, as a result I should get a list [RD, ZDIR, DIR]. The search procedure is shown in the screenshot https://www.screencast.com/t/EWJwIeNJDg84

The maximum length of the result list is 5.

Hello,

Your “left” column could refer to your “right” column using an AppSheet REF. Here’s an example (unrelated to your question) which let’s you build a hierarchy.

https://www.appsheet.com/samples/Sample-App?appGuidString=7e115b1c-1bb3-464d-9c23-cf54e7795b99

Take a close look at the data as well as the table called “hierarchy”.

Hope this helps! -Ty