[rt-users] Can I use % wildcard within Query Builder on QUEUES?
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' orQueue! = '_%UAT' b) Queue = '%UAT' orQueue! = '%UAT' I have also tried to use MATCHES or LIKE instead of '=' but I cannot get any of this to work. I have spent the last hour and a half searching on-line and have tried various things can anyone confirm if it is possible to search using the Wildcard characters on QUEUES within QUREY BUILDER? And if YES - how could I get the above to work. Many thanks in advance Sally Sally Ainsley
Re: [rt-users] Can I use % wildcard within Query Builder on QUEUES?
Thanks Matt for prompt response I was hoping to do something in the Query Builder as I would need to secure some technical resource internally to go down the perl route as I don't have the knowledge for perl. I got the same error as you below when I tried the LIKE operator. Perhaps LIKE doesn’t work on the QUEUE field for some reason. Sally Ainsley | Lifecycle Software | T: 01635 553427 -Original Message- From: Matt Zagrabelny [mailto:mzagr...@d.umn.edu] Sent: 29 September 2015 16:27 To: sally.ains...@lifecycle-software.com; rt-users <rt-users@lists.bestpractical.com> Subject: Fwd: [rt-users] Can I use % wildcard within Query Builder on QUEUES? On Tue, Sep 29, 2015 at 10:05 AM, Sally Ainsley <sally.ains...@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' orQueue! = '_%UAT' > > b) Queue = ’%UAT’ orQueue! = '%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
Re: [rt-users] Can I use % wildcard within Query Builder on QUEUES?
On Tue, Sep 29, 2015 at 10:38 AM, Bryon Bakerwrote: > Hello Sally and Mat > The like phrase works you just need to use the "Advanced" button at top of > page. At that point you can type in the phrase you would like. Sure. But not for Queue. ;) LIKE isn't supported for Queues. > I use this phrase in reports because I do not want the data in my > calculations. > > Requestor.EmailAddress Not Like '%DAEMON%' You don't need the percent signs. RT adds them automatically. -m
Re: [rt-users] Can I use % wildcard within Query Builder on QUEUES?
On Tue, Sep 29, 2015 at 10:32 AM, Sally Ainsleywrote: > Thanks Matt for prompt response > > I was hoping to do something in the Query Builder as I would need to secure > some technical resource internally to go down the perl route as I don't have > the knowledge for perl. Sure. > I got the same error as you below when I tried the LIKE operator. Perhaps > LIKE doesn’t work on the QUEUE field for some reason. Without looking into the code, there is a limitation on operators that can be used with the Queue in building your search. You could: A. File a feature request asking for LIKE (or matches) to be added to the operator list. I can't comment on the likelihood of it getting cycles for a future release. B. A perl dev in your company could hack up a patch to support it. C. Ask Best Practical for a quote to get RT to do what you'd like. Cheers, -m
Re: [rt-users] Can I use % wildcard within Query Builder on QUEUES?
Hi Matt and Byron Many thanks for your input I think I have a work around. I tried the LIKE option in the Advanced button at the top of the page but I get the horrid red "Couldn't parse query" error that Matt described in the email trail. So for some reason whilst LIKE works with Fields like Requestor.EmailAddress field (as per Byron's email) it does not work on QUEUE. I have therefore reviewed the options within the QUERY BUILDER where 'matches' is a drop down option. There is a long list of fields where this would work (not just REQUESTOR) and one of these is QueueAdminCC. So what I have done is created a Test User in RT and put this Test User as the QueueAdminCC for my Queues which have a name with "UAT "in them. I can then write Queries with the QUERY BUILDER or the ADVANCED BUTTON that include [QueueCc.Name LIKE 'test'] as one of the rules to get all my UAT Queues This is not ideal but I can now write queries to select several queues that I will not need to update each time we add a new Queue - I will simply update our internal instructions so that when new Queues are set up them up with the Test user in the QueueAdminCC field. Many thanks Sally -Original Message- From: Bryon Baker [mailto:bba...@copesan.com] Sent: 29 September 2015 16:38 To: Sally Ainsley <sally.ains...@lifecycle-software.com>; 'Matt Zagrabelny' <mzagr...@d.umn.edu>; 'rt-users' <rt-users@lists.bestpractical.com> Subject: RE: [rt-users] Can I use % wildcard within Query Builder on QUEUES? Hello Sally and Mat The like phrase works you just need to use the "Advanced" button at top of page. At that point you can type in the phrase you would like. I use this phrase in reports because I do not want the data in my calculations. Requestor.EmailAddress Not Like '%DAEMON%' Thanks Bryon Baker Network Operations Manager Copesan - Specialists in Pest Solutions 800-267-3726 • 262-783-6261 ext. 2296 bba...@copesan.com www.copesan.com "Servicing North America with Local Care" -Original Message- From: rt-users [mailto:rt-users-boun...@lists.bestpractical.com] On Behalf Of Sally Ainsley Sent: Tuesday, September 29, 2015 10:32 AM To: 'Matt Zagrabelny'; 'rt-users' Subject: Re: [rt-users] Can I use % wildcard within Query Builder on QUEUES? Thanks Matt for prompt response I was hoping to do something in the Query Builder as I would need to secure some technical resource internally to go down the perl route as I don't have the knowledge for perl. I got the same error as you below when I tried the LIKE operator. Perhaps LIKE doesn’t work on the QUEUE field for some reason. Sally Ainsley | Lifecycle Software | T: 01635 553427 -Original Message- From: Matt Zagrabelny [mailto:mzagr...@d.umn.edu] Sent: 29 September 2015 16:27 To: sally.ains...@lifecycle-software.com; rt-users <rt-users@lists.bestpractical.com> Subject: Fwd: [rt-users] Can I use % wildcard within Query Builder on QUEUES? On Tue, Sep 29, 2015 at 10:05 AM, Sally Ainsley <sally.ains...@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' orQueue! = '_%UAT' > > b) Queue = ’%UAT’ orQueue! = '%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
Re: [rt-users] Can I use % wildcard within Query Builder on QUEUES?
Hello Sally and Mat The like phrase works you just need to use the "Advanced" button at top of page. At that point you can type in the phrase you would like. I use this phrase in reports because I do not want the data in my calculations. Requestor.EmailAddress Not Like '%DAEMON%' Thanks Bryon Baker Network Operations Manager Copesan - Specialists in Pest Solutions 800-267-3726 • 262-783-6261 ext. 2296 bba...@copesan.com www.copesan.com "Servicing North America with Local Care" -Original Message- From: rt-users [mailto:rt-users-boun...@lists.bestpractical.com] On Behalf Of Sally Ainsley Sent: Tuesday, September 29, 2015 10:32 AM To: 'Matt Zagrabelny'; 'rt-users' Subject: Re: [rt-users] Can I use % wildcard within Query Builder on QUEUES? Thanks Matt for prompt response I was hoping to do something in the Query Builder as I would need to secure some technical resource internally to go down the perl route as I don't have the knowledge for perl. I got the same error as you below when I tried the LIKE operator. Perhaps LIKE doesn’t work on the QUEUE field for some reason. Sally Ainsley | Lifecycle Software | T: 01635 553427 -Original Message- From: Matt Zagrabelny [mailto:mzagr...@d.umn.edu] Sent: 29 September 2015 16:27 To: sally.ains...@lifecycle-software.com; rt-users <rt-users@lists.bestpractical.com> Subject: Fwd: [rt-users] Can I use % wildcard within Query Builder on QUEUES? On Tue, Sep 29, 2015 at 10:05 AM, Sally Ainsley <sally.ains...@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' orQueue! = '_%UAT' > > b) Queue = ’%UAT’ orQueue! = '%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