[rt-users] Fwd: Can I use % wildcard within Query Builder on QUEUES?
Matt Zagrabelny
mzagrabe at d.umn.edu
Tue Sep 29 11:27:22 EDT 2015
On Tue, Sep 29, 2015 at 10:05 AM, Sally Ainsley
<sally.ainsley at lifecycle-software.com> wrote:
> Dear All
>
>
>
> I have a range of queries I am trying to create in QUERY BUILDER where I
> want to include or exclude a list of QUEUES.
>
>
>
> E.g.
>
> QUEUE NAME 1 = BLUE
>
> QUEUE NAME 2 = BLUE -UAT
>
> QUEUE NAME 3 = RED
>
> QUEUE NAME 2 = RED-UAT
>
>
>
> I would like to be able to include or exclude QUEUES with the letters “UAT”
> within them.
>
>
>
> Using the ADVANCED option of the QUERY BUILDER I have tried:
>
>
>
> a) Queue = '_%UAT' or Queue! = '_%UAT'
>
> b) Queue = ’%UAT’ or Queue! = '%UAT'
>
>
>
> I have also tried to use MATCHES or LIKE instead of ‘=’ but I cannot get any
> of this to work.
If it were to work, "LIKE" would be the operator. However, I don't
think it will work.
If you look at the Search Builder page, there is only "is" and "isn't"
in the drop down for building the Queue predicate.
I just tried it with LIKE and got the following error:
[error]: Couldn't parse query: Invalid Operation: LIKE for Queue at
/opt/rt4/sbin/../lib/RT/Tickets.pm line 368.
That said, depending on what your final needs are you could write some
supporting perl to achieve a similar effect:
# Not tested...
my @matching_queues = ();
my $Queues = RT::Queues->new($session{CurrentUser});
while (my $Queue = $Queues->next) {
if ($Queue->Name =~ /UAT$/) {
push @matching_queues, $Queue->Name;
}
}
my $sql =
join ' OR ',
map { "Queue = '$_'" },
@matching_queues,
;
my $Tickets = RT::Tickets->new($session{CurrentUser});
$Tickets->FromSQL($sql);
# end of untested code.
Perhaps that would help.
-m
More information about the rt-users
mailing list