Zoltan, that will still find the first instance of BBBB, not the second. All that says is "Find me the text object that is BBBB AND not ADMIN." The first BBBB matches that (it is BBBB and is NOT ADMIN), so Ranorex will stop there. There is no way to say "Find me an object that has a child of BBBB and doesn't have a child of ADMIN", unfortunately, as that is what we are looking for here. (As far as I know!
Maybe the support team can enlighten us if there is a way. I would love to hear it!)
puntapret, there is no way to do it the way your application is structured, from what I can see. If I were in your position, I would ask the developers to add a unique way to identify the elements that wouldn't change if the dom structure changes. For instance, add unique ids or class attributes to the two link objects. The first could be @id='Link1' and the second could be @id='Link2', for all we care, as long as those ids don't change if the structure changes.
Without doing something along those lines, you are going to continue to run into issues. Remember, Ranorex is software and runs on a computer, which means it can't think or reason the way you and I can, so we have to be able to tell it EXACTLY what we want it to do. It can't just look at two items that match and pick the right one, it will always pick the first one. In this case we can't get by without using an index or other structure-based mechanism unless we have some unique identifier, because of the limits of XPath and Ranorex's logic (mainly XPath...).
Shortcuts usually aren't...