Sub Xpath constraints ignoring secondary constraints

I am running a retrieve action on two objects Consumer and ConsumerBureau. On the secondary object ConsumerBureau I am trying to select only consumer bureaus where they: come from a specific source bureau has administrative orders or filter says not to include it However the xpath seems to be ignoring the not($Filter/includeAdministrativeOrder) [not($Filter/IncludeAge) or (Age >= $Filter/AgeMin and Age <= $Filter/AgeMax)] [(Consumer.ConsumerBureau_Consumer/Consumer.ConsumerBureau [Consumer.ConsumerBureau_Source=$Source and (AdministrationOrder=$Filter/AdministrationOrder and $Filter/IncludeAdministrationOrder) ]) ] This filter will become more complex Thanks Graham
1 answers

It's not necessary to do 2 retrieves (as recommended in a comment), I just think your query doesn't do what you think it should do, concerning the 'not' part. You can just negate a Boolean with != true().

I would try rewriting it like

[$Filter/IncludeAge != true() or (Age >= $Filter/AgeMin and Age <= $Filter/AgeMax)]

And change the other part as well of course