[rt-users] using date calcs in reports

Matt Zagrabelny mzagrabe at d.umn.edu
Tue Jul 7 17:08:17 EDT 2015


On Sun, Jul 5, 2015 at 11:46 PM, Chris Herrmann
<chrisherrmann7 at gmail.com> wrote:
> Hi all,
>
> I can currently export a list of tickets with most of the data I need like
> this:
>
> rt list "queue = 'myqueue' and (  ( Status = 'open' or Status = 'new') OR (
> Resolved > '$startdate' ) )" -f
> id,subject,status,timeworked,requestors,created,started,
> lastupdated,resolved > /tmp/report.tsv
>
> Now... what I'd like to do is calculate the difference between Created &
> Started... I'm pretty sure that Date::Calc  -  Delta_DHMS will give me what
> I want... but I'm not sure how to use this in the query above. Is that even
> possible?

The following has not been tested with the 'rt' CLI tool.

You could extend RT::Ticket to create a function called
time_until_started, then create a ColumnMap for that new function.

I've written something similar to this (for 3.8) where I wanted to get
the "previous owner" of a ticket and be able to use that as a column
in searches. Attached is the code. I'm not sure if there are changes
necessary for 4.0 or 4.2.

There are 3 important files:

./html/Callbacks/RT-Extension-PreviousOwner/Elements/RT__Ticket/ColumnMap/Once
./html/Callbacks/RT-Extension-PreviousOwner/Search/Elements/BuildFormatString/Default
./lib/RT/Extension/PreviousOwner.pm

Cheers,

-m
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rt-extension-previousowner.tar.gz
Type: application/x-gzip
Size: 30600 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20150707/678c047b/attachment.bin>


More information about the rt-users mailing list