[rt-users] Query in script not working

Mathew Snyder mathew.snyder at gmail.com
Mon Feb 25 09:32:43 EST 2008


I'm trying to get all of the tickets which, for any given day, were LastUpdated
'yesterday'.  When I do a search within RT using " LastUpdated = '2008-02-24'
AND  (  Queue = 'CustomerCare' OR Queue = 'TechOps' )" I'm shown 8 tickets.
However, when I run the following script I get nothing.

#!/usr/bin/perl

use warnings;
use strict;
use lib '/usr/local/rt3/lib';
use lib '/usr/local/rt3/local/lib';
use RT;
use RT::Tickets;

RT::LoadConfig();
RT::Init();

my @date2 = (localtime(time - 86400))[3 .. 5];
my $yesterday = join "-", ($date2[2] + 1900, (sprintf '%02d',$date2[1] + 1),
(sprintf '%02d', $date2[0]));

my $tix = new RT::Tickets(RT::SystemUser);
$tix->FromSQL('(Queue = "CustomerCare" OR Queue = "TechOps") AND LastUpdated =
"' . $yesterday . '"');

while (my $ticket = $tix->Next) {
    print $ticket->id . "\n";
}

Anyone care to put a second(or third or fourth) pair of eyes on this to maybe
see something I've missed?

Thanks
Mathew
-- 
Keep up with me and what I'm up to: http://theillien.blogspot.com



More information about the rt-users mailing list