Querybuilder problems

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)’ ) )

I have tried to set this with the advanced builder, the tree builder etc…

all set it back to

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

(notice the OR going to AND)…

Not much point in the Braces if you cant select OR… :-/

Compounding the problem I cannot find where the custom searches are
stored in the DB (hints/pointers gratefully accepted).

Regards

Mat

-----Original Message-----
From: rt-devel-bounces@lists.bestpractical.com
[mailto:rt-devel-bounces@lists.bestpractical.com] On Behalf
Of Matthew Sullivan
Sent: Monday, December 18, 2006 6:38 AM
To: RT Devel
Subject: [Rt-devel] Querybuilder problems.

(notice the OR going to AND)…

Compounding the problem I cannot find where the custom searches are
stored in the DB (hints/pointers gratefully accepted).

Mat,

There are various bugs in this aspect of Query Builder, depending on which
version of RT you’re on. I’d suggest trying parentheses round every
condition.

The saved searches are stored in attributes against the user or group
object, depending on their scope. I think they are encoded, so looking in
the DB may not help, unless you write a perl script to extract & decode
them.

Steve

Stephen Turner
Senior Programmer/Analyst - Client Support Services
MIT Information Services and Technology (IS&T)

version of RT you’re on. I’d suggest trying parentheses round every
condition.

I actually suggest building with query builder, then using the SQL
interface to fix up the query. It goes way faster for me that way.

A

Andrew Sullivan | ajs@crankycanuck.ca
In the future this spectacle of the middle classes shocking the avant-
garde will probably become the textbook definition of Postmodernism.
–Brad Holland

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)’ )
)”

[snip]

Regards

Mat

Best regards, Ruslan.

Ruslan Zakirov wrote:> On 12/18/06, Matthew Sullivan matthew@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

sorry, I missed a level, everything ok with your query. I checked RT
3.6.2 and everything works fine.On 12/19/06, Matthew Sullivan matthew@sorbs.net wrote:

Ruslan Zakirov wrote:

On 12/18/06, Matthew Sullivan matthew@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

Best regards, Ruslan.

Ruslan Zakirov wrote:

sorry, I missed a level, everything ok with your query. I checked RT
3.6.2 and everything works fine.

Well that’s the thing… 3.6.1_1 (FreeBSD) it won’t save either as the
query editor, nor when built using the treebuilder - it keeps turning
the second OR back to an AND…

/ Mat