Thanks to you both for your replies most appreciated.
I'll look in to working out how to implement a custom query and let you know how I go.
This is already in the context of a hierarchical viewer it's one of the transformations to see if it has children and apply a dropdown class.
I'll look in to custom queries now. thank you :)