On Oct 4, 2016, at 10:28 AM, Anthony Nguyen-Duong 
<[email protected]<mailto:[email protected]>> wrote:


Hi,

I'd like to find out how to add my own calculation to charts, as opposed to the 
limited Ticket Count and various time calculations available for charts.
I'd like to add a calculation that calculates the number of 
emails/correspondences between an agent and a customer. I've tried looking 
through "lib/RT/Report/Tickets.pm" and "share/html/Search/Chart.html", but 
there's a lot of things I don't understand in there.

Now, realistically I may not have to go through the effort of adding a 
calculation for charts.
My end result is a table that has the columns: TicketId, NumberOfEmails (and 
I'll probably add some other things like Subject and whatnot). However, I'd 
prefer not to have a Custom Field for NumberOfEmails, reason being I'm not sure 
if there's a way to calculate the number of emails for all my past tickets and 
set all of them to their correct value apart from manually counting and 
inputting it. Instead, I was considering doing Callbacks or something to count 
the number of Correspondences in the Transactions table from the database and 
appending a column to a table.

We have two CFs that are populated - ClientReplies, StaffReplies and can be 
used in the charts.  I've done this twice before with two different approaches.

The first approach worked like this:
A crontab would use an action which would do this for each ticket.  It would 
cycle through all the create and correspond transactions and attribute them to 
either staff or clients then update the CF when it was done.  This meant that 
every single create,correspond transaction was processed for every ticket every 
time it ran.  It was a wasteful way to do it.

The second approach worked like this:
Two conditions were created - One that detected 'staff' correspondence and 
another to detect 'client' (non-staff) correspondence.  Depending on which 
condition was true an action to increment the appropriate CF (read the current 
CF value, add 1, delete the old CF value, record the new CF value).  The net 
effect was that the CFs were updated only when it was necessary.  This is a 
much more efficient way to do it.

--
Landon Stewart
Lead Analyst - Abuse and Security Management
INTERNAP ®
📧 [email protected]<mailto:[email protected]>
🌍 www.internap.com<http://www.internap.com>

---------
RT 4.4 and RTIR training sessions, and a new workshop day! 
https://bestpractical.com/training
* Boston - October 24-26
* Los Angeles - Q1 2017

Reply via email to