Filter a list

Given the example list:    I filter the List A by status “waiting”, as a result I get the List B. The Code Q007 (in yellow) represent the code of the current user (that is also the system owner) and what I need next is to filter the list B in order to get all the codes that exist before the current user code, in tis case Q007, how can I do this?   for reference, the entity that I’m using looks like this 
1 answers

Create an empty Access_code list.

Loop through list B (make sure it’s sorted ascending by code)

When code != current user code, add object to the new list

When code = current user code, break out of the loop

The created list should now contains all Access_codes before your user’s code.