[rt-users] Report for original queue count

Vegard Vesterheim vegard.vesterheim at uninett.no
Thu Jan 22 05:25:28 EST 2015


On Tue, 6 Jan 2015 14:36:32 -0500 "Hamilton T. Preston" <hamiltontpreston at gmail.com> wrote:

> How would I write a report to count the number of tickets created in a
> queue? Many of our tickets are moved to other queues and I don't know
> how to get counts on the original queue the ticket was created in.

I am tasked with a similar problem. My approach is to search for
Transactions where the Queue Field has been changed, something like
this:

----- snip - snip -------------------------------------------------
my $queuename = 'myqueue';
CleanEnv();
RT::LoadConfig();
RT::Init();
my $user = RT->SystemUser;
my $queue = new RT::Queue($user);
$queue->Load($queuename);

my $objs = RT::Transactions->new( $user );

$objs->Limit( FIELD => 'ObjectType', VALUE => "RT::Ticket", ENTRYAGGREGATOR => 'AND');
$objs->Limit( FIELD => 'Field',      VALUE => "Queue",      ENTRYAGGREGATOR => 'AND' );
$objs->Limit( FIELD => 'OldValue',   VALUE => $queue->Id,   ENTRYAGGREGATOR => 'AND' );
$objs->OrderBy( FIELD => 'Created');
my $ticket = RT::Ticket->new($user);
while (my $t = $objs->Next) {
    $ticket->Load ($t->ObjectId);
}

----- snip - snip -------------------------------------------------

This is a sledgehammer approach, I know. If you have a many
tickets/transactions, the query could take a long time. 

In my case I want to restrict the search to a given timeperiod, aka: "How
many tickets where moved out of queue <foo> yesterday")

Hope this helps.

 - Vegard V -



More information about the rt-users mailing list