" /> How to get a formula to output the exact content of another statistic? - Genesys CTI User Forum

Author Topic: How to get a formula to output the exact content of another statistic?  (Read 3211 times)

Offline molkemon

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Advertisement
Hi,

I made a formula to translate NotReady reasons to (hh:mm:ss) Reason. However, I also want to make a condition that if the agent isn't NotReady, the formula should output what is basically "ExtendedCurrentState".

[img]http://imgur.com/jG5YTg6.jpg[/img]

I tried with "return ccpulse.group("MyAgentStateGroup").statistic("ExtendedCurrentState").

However when I do this, it only returns weird numbers, like 4 or 22. How can I get the output of the Status column for agents that are not NotReady exactly as it is in the "StatusAlt" column on the screenshot?

Alternatively, I tried with state.Status. This returns the correct state as text, but how can I get the current time in the state with it?

« Last Edit: November 18, 2016, 09:07:00 PM by molkemon »

Offline Tambo

  • Sr. Member
  • ****
  • Posts: 456
  • Karma: 5
Re: How to get a formula to output the exact content of another statistic?
« Reply #1 on: November 21, 2016, 01:57:41 PM »
is this in pulse or ccpulse ?

Offline Jones

  • Jr. Member
  • **
  • Posts: 67
  • Karma: 0
Re: How to get a formula to output the exact content of another statistic?
« Reply #2 on: November 22, 2016, 12:52:42 PM »
Use this statistic for reasons + time output

[CurrentStateReasons]
Category=CurrentStateReasons
MainMask=*
Objects=Agent
ReasonStartOverridesStatusStart=yes
Subject=DNAction
« Last Edit: November 22, 2016, 01:07:02 PM by Jones »

Offline molkemon

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Re: How to get a formula to output the exact content of another statistic?
« Reply #3 on: November 22, 2016, 11:45:41 PM »
@Tambo: This is ccpulse.

@Jones: I cannot create statisctics, I have only full privilege to the ccpulse client, not server administration rights.

Offline Tambo

  • Sr. Member
  • ****
  • Posts: 456
  • Karma: 5
Re: How to get a formula to output the exact content of another statistic?
« Reply #4 on: November 23, 2016, 08:21:55 AM »
http://www.sggu.com/smf/index.php/topic,9896.0.html

if you use search you may find the answer

Offline molkemon

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Solution to this: use the state object with state.StartTime and state.Status

After evaluating for all reason codes, if the current status is NOT NotReadyForNextCall(Reason) then do this:

var startzeit = state.StartTime;
var datumob = new Date(startzeit);
var datumobtoms = datumob.valueOf();
var datumob2 = new Date();
var differenz = (datumob2.getTime() - datumobtoms) / 1000;

var d = differenz
var h = Math.floor(d / 3600);
var m = Math.floor(d % 3600 / 60);
var s = Math.floor(d % 3600 % 60);
var f = ((h > 0 ? (h < 10 ? "0" : "") + h + ":" : "00:") + (m > 0 ? (m < 10 ? "0" : "") + m + ":" : "00:") + (s < 10 ? "0" : "") + s);
return "(" + f + ") " + state.Status;
« Last Edit: April 19, 2018, 02:07:34 PM by molkemon »