Are you trying to compare every element with the value, or just the first one?
If you are just comparing the first, you just need do a comparison from value to that y element since you are using height. That if true, just set that date as the new value in that element.
If you are comparing every element, you can create a For loop and use a variable based on how many elements you have, so it will check every one. For example, there are 5 y elements, or 4 in y heights. So For Y < 5. Start with Y at 0 and than in the end of each action, add one to Y.