[rt-users] Using CLI to Report Tickets Matching a Date Criteria

Todd Chapman rt at chaka.net
Tue Dec 7 12:14:19 EST 2004


Here is the start of a Perl script that will put you a little closer to
what you want:

#!/usr/bin/perl

use strict;
use warnings;
use lib qw(/opt/rt3/local/lib /opt/rt3/lib);

use RT;
RT::LoadConfig();
RT::Init();
use RT::Tickets;
use Date::Calc;

my @d1 = Date::Calc::Add_Delta_Days(Date::Calc::Today, -28);
my @d2 = Date::Calc::Today;

print "Monthly Request Tracker Report\n";
print "Start date: $d1[0]-$d1[1]-1\n";
print "End date:   $d2[0]-$d2[1]-1\n\n";

my $tickets = RT::Tickets->new( $RT::SystemUser );
$tickets->{'allow_deleted_search'} = 0;
$tickets->IgnoreType();
$tickets->UnLimit();
$tickets->LimitQueue( VALUE => 'My Queue' );
$tickets->LimitCreated( OPERATOR => '>', VALUE => $d1[0] . '-' . $d1[1] . '-01');
$tickets->LimitCreated( OPERATOR => '<', VALUE => $d2[0] . '-' . $d2[1] . '-01');
my $total =  $tickets->Count();

On Tue, Dec 07, 2004 at 10:25:06AM -0600, geno at onshore.net wrote:
> We have been using RT for a while now but have been worried about upgrading to
> version 3.  I work for an ISP and we use RT for our ticketing system and also
> have a monthly bonus that is based on the percentage of tickets closed each
> month.  For our current version we have a shell script that has the RT2 CLI
> reporting which tickets were created after the 1st of the month and prior to
> the first of the next month in certin queues and then report how many tickets
> were
> closed within that time period.  It takes both values and divides them to come
> up with the percentage resolved.  I'm having probelms figuring out the syntax
> in RT3's CLI.  I understand how it works but I can't figure out the proper
> expression.  How would I declare creation dates and give it greater and lesser
> than values?  Is this possible?  From reading some of the posts it seems like
> this is not possible?  Any kind of help would be much appriciated.  We are
> holding off on our version 3 upgrade until we can get some sort of solution in
> place.  It's a bit ridiculous that we havn't upgraded yet but I can only do it
> when I'm told the time is right.  Thanks for any information you guys can
> provide.  Take care.
> 
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> 
> Be sure to check out the RT wiki at http://wiki.bestpractical.com



More information about the rt-users mailing list