<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
On Oct 4, 2016, at 10:28 AM, Anthony Nguyen-Duong <<a href="mailto:anthnd@hotmail.com" class="">anthnd@hotmail.com</a>> wrote:<br class="">
<div>
<blockquote type="cite" class=""><br class="Apple-interchange-newline">
<div class="">
<div id="divtagdefaultwrapper" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif;" class="">
<p style="margin-top: 0px; margin-bottom: 0px;" class=""><span id="ms-rterangepaste-start" class=""></span></p>
<div style="margin-top: 0px; margin-bottom: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;" class="">
Hi,</div>
<div style="margin-top: 0px; margin-bottom: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;" class="">
<br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;" class="">
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.</div>
<div style="margin-top: 0px; margin-bottom: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;" class="">
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. </div>
<div style="margin-top: 0px; margin-bottom: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;" class="">
<br class="">
</div>
<div style="margin-top: 0px; margin-bottom: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;" class="">
Now, realistically I may not have to go through the effort of adding a calculation for charts. </div>
<div style="margin-top: 0px; margin-bottom: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px;" class="">
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.</div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
</div>
<div class="">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.</div>
<div class=""><br class="">
</div>
<div class="">The first approach worked like this:</div>
<div class="">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.</div>
<div class=""><br class="">
</div>
<div class="">The second approach worked like this:</div>
<div class="">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.</div>
<div class=""><br class="">
</div>
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
--<br class="">
Landon Stewart<br class="">
Lead Analyst - Abuse and Security Management<br class="">
INTERNAP ®<br class="">
📧 <a href="mailto:lstewart@internap.com" class="">lstewart@internap.com</a><br class="">
🌍 <a href="http://www.internap.com" class="">www.internap.com</a></div>
</div>
</div>
<br class="">
</body>
</html>