[Rt-devel] Querybuilder problems.

Matthew Sullivan matthew at sorbs.net
Tue Dec 19 00:23:18 EST 2006


Ruslan Zakirov wrote:
> On 12/18/06, Matthew Sullivan <matthew at sorbs.net> wrote:
>> Any reason why this would fail...
>>
>>  Queue != 'DUHL Removals' AND  (  Status = 'new' OR Status = 'open' )
>> AND Owner = 'Nobody' AND  (  Queue != 'DUHL' OR  (  Subject NOT LIKE
>> '(Autohandle)' AND Queue = 'DUHL' AND Subject NOT LIKE '(support 
>> form)' ) )
> From RT point of view it's incorrect query and I don't think it's
> correct from people view too.
>
> From RT point of view problem is in aggregators, on one level of a
> query you must use only ORs or only ANDs. So "(COND AND COND OR COND)"
> is incorrect as it's ambiguous, you must write "((COND AND COND) OR
> COND)" or "(COND AND (COND OR COND))" which are different as you can
> see.
>
> From my point of view you need something like:
> "Queue != 'DUHL Removals'
> AND ( Status = 'new' OR Status = 'open' )
> AND Owner = 'Nobody'
> AND (
>  ( Queue != 'DUHL' AND Subject NOT LIKE '(Autohandle)' )
>  OR ( Queue = 'DUHL' AND Subject NOT LIKE '(support form)'  )
> )"

It's supposed to read:

      Queue != 'DUHL Removals'
AND ( Status = 'new' OR Status = 'open' )
AND   Owner  = 'Nobody'
AND ( Queue != 'DUHL' OR ( Subject NOT LIKE  '(Autohandle)'
                           AND Queue = 'DUHL'
                           AND Subject NOT LIKE '(support form)'
                         )
    )

In plain English:

No tickets in the DUHL Removals queue.
No tickets in the DUHL queue except those without '(Autohandle)' or 
'(support form)' in them.
All other tickets status "new" or "open" and not owned by anyone.

So there is only one OR on that level.... or am I not understanding?

Regards,

Mat


More information about the Rt-devel mailing list