No, The way the OP tried to explain it is that he has a robot (no idea if it looks at another PLC or is controlled by the PLC), however, It appears that the robot is somehow reading DB1.DBW0 (one variable), so the way I see it work is that there are 10 variables (containers) perhaps a poor choice of words but for example 10 variables that hold values or number of parts, at some point the robot requests a new set of parts from the array, the PLC then loops though these & picks the one with the lowest number but not 0, & stores it in DB1.DBW0 for the robot to use, he also mentioned some form of enable i.e. the container in the 10 variables.
So this is how I see it working.
A request for the next lowest set of parts.
a bit is set, runs the code by looping through it checks if the container is not 0, and is enabled, the value in the first container is checked for > 0 & enabled then put into a temp, next loop the temp is compared with the container +1 again if > 0 AND enabled and less than the previous it overwites the temp
Does this for all 10 containers then transfers the temp into DB1.DBW0
So effectively there is a 2 dimensional array Array(Value,Enabled)
I have chosen as an idea for it to be in one DB DB1.DBW0 is the one the robot uses, then some spares (you never know), DB1.DBW12 to 30 are the 10 parts value containers & DB1.DBW32 - 50 are the enables
Not done it as arrays (this always uses consecutive words not sure if OP will decipher it so used seperate areas & STL is easy).
The OP seemed to indicate that these cells would be on an HMI & can be manipulated by an operator. i.e. perhaps the values are entered manually, can be enabled etc. so we have no idea how the data is entered into the array, perhaps only manually, perhaps by some other process, may have got it wrong & does need sorting, in other words takes the 10 containers & stores them in order lowest to highest then shifts them into the robot cell, although the OP has indicated what I have posted seems to be something like. Also many other questions, is there a need to zero the containers once transferred, remove the enable, does the robot decrement the parts in DB1.DBW0 How do we tell the robot we have moved new data into the robot container ? so many questions.
The code I produced was done on the fly in about 20 mins, tested partly for about 10, could re-jig it in so many ways but why change something that works.
This is always the problem in answering posts, lack of relevant info, interpretation of the problem language barriers.
For example, I often send emails to freinds in Thailand who cannot speak English, my Thai is a few words, cannot translate into their characters, so use Google to translate, many other languages reverse the words & have the same words that mean different things depending on the preceeding or following word. fish sauce is nam pla, nam is water or a liquid or sauce, so for example literally translated its water fish, sauce fish, liquid fish. Google is pretty good but not perfect, once sent an email, google translated it but the translation put some words that were well rather ****ographic, fortunately they understood that it was not me being rude.