Genesys CTI User Forum

Genesys CTI User Forum => Genesys CTI Technical Discussion => Topic started by: molkemon on November 18, 2016, 09:03:43 PM

Title: How to get a formula to output the exact content of another statistic?
Post by: molkemon on November 18, 2016, 09:03:43 PM
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?

Title: Re: How to get a formula to output the exact content of another statistic?
Post by: Tambo on November 21, 2016, 01:57:41 PM
is this in pulse or ccpulse ?
Title: Re: How to get a formula to output the exact content of another statistic?
Post by: Jones 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
Title: Re: How to get a formula to output the exact content of another statistic?
Post by: molkemon 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.
Title: Re: How to get a formula to output the exact content of another statistic?
Post by: Tambo 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
Title: Re: How to get a formula to output the exact content of another statistic?
Post by: molkemon on April 19, 2018, 01:57:17 PM
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;