By default the compare values condition just picks the first instance of an object, so it doesn't work with multiple instances. That's why distance() doesn't appear to work with multiple instances.
However, you can fix it with for-each:
+ For each A
+ For each B
+ distance(A.x, A.y, B.x, B.y) < 100
-> A: look at B
This repeats the distance() comparison for every combination of A and B, so every A looks at a B inside its range. (Not the nearest one - that's a fair bit more complicated - but it works OK this way.)