Can't display the right data from the database

Hi there,
I am still relatively new to Bubble. My issue is that my user fields would keep resetting when navigating to other pages. To combat this, I made a temporary database which retrieves the last changes made in the user fields for inputs and display them again when the page loads.

However, users can be logged in with different categories per say. In this instance workers working on a machine called “3D2” may retrieve the last changes of the data from another machine that made more recent changes from another machine “4DB01” as seen below…

Instead, it would just retrieve the top result from “4DBO1” as it is the last result to pop up in the database.

Here is the workflow I have going for steps 1 - 3 on how this is working…



And here is the further display data settings with a small explanation…

Basically one of the big issues is I want it to display a number from the database but through the last result of text or custom state called “machines” that the current user is logged in with.

Any help is appreciated, thank you!