Dynamic Groups Where Clause

Hello,

I have a difficult question. In our 8.1.4 we need in where-clause of dynamic groups retrieve "Uid_DynamicRoles" of these dynamic groups in order to get different Uid_Department from different Itshops (which have customer nodes with these corresponded dynamic groups). But how can we dynamicaly get in where-clause "Uid_DynamicGroups" of Dynamic Groups? It would unify our approach and write one single script to all of our dynamic groups.