Show plain TimeWorked in search results

Hello,

I wonder whether is possible to show the plain TimeWorked field in the search results, instead of the one formated like “15 minutes” or “1 hour and 5 minutes”. Do you know how to do it?

I like to export the search results to a spreadsheet and get the total for that column, but I can not do so because of the format. I would like the column would show the values in plain minutes like “25”, “10”, etc.

Regards,

There doesn’t appear to be a config for this, it’d be easy to make your own column map that gets the value and doesn’t convert it into that string:
https://docs.bestpractical.com/rt/5.0.0/customizing/search_result_columns.html#Column-Maps

Hi @knation,

I owe you one. Thank you very much for pointing out towards the solution. I created a column map following the example and now I can show the time worked in each ticket without format.

This is what I did, just in case anybody has the same question.

Create the file /usr/local/share/request-tracker4/html/Callbacks/MyRT/Elements/RT__Ticket/ColumnMap/Once with the following content:

<%init>
    $COLUMN_MAP->{'MinutesWorked'} = {
            title     => 'MinutesWorked',
            attribute => 'MinutesWorked',
            value     => sub {
                my $ticket = shift;
                return $ticket->TimeWorked;
            }
    };
</%init>
<%args>
$COLUMN_MAP
</%args>

Then, create the file /usr/local/share/request-tracker4/html/Callbacks/MyRT/Search/Elements/BuildFormatString/Defaultwith this content:

<%INIT>
push @{$Fields}, 'MinutesWorked';
</%INIT>
<%ARGS>
$Fields => undef
</%ARGS>

And that’s all. After that you’ll have a new field called MinutesWorked which you can add to the results table.

Regards,

2 Likes