Genesys CTI User Forum

Genesys CTI User Forum => Genesys CTI Technical Discussion => Topic started by: PFCCWA on October 13, 2009, 12:19:09 PM

Title: CCPulse formula decimal places
Post by: PFCCWA on October 13, 2009, 12:19:09 PM
Hello,

I have created a forumula within a template but the statistic automatically displays 2 digits whereas I would like it to be rounded up? i.e. 7.93

Is this possible?

I think I may need to add this to the formula but not sure how.

Thanks,
WA
Title: Re: CCPulse formula decimal places
Post by: ecki on October 13, 2009, 01:52:26 PM
Hi,

That is Java Script, so you can use something like this Math.round(10.1234)

e.
Title: Re: CCPulse formula decimal places
Post by: ecki on October 13, 2009, 02:32:25 PM
Or you can try formating result. Put this on the beginning.
result.Long =
Title: Re: CCPulse formula decimal places
Post by: PFCCWA on October 13, 2009, 05:01:13 PM
Hello,

Thanks for the response, it has worked for the following formula:

result.Long = ((ccpulse.group("% Time Spent").statistic("Total_Login_Time 1") / 60) / 60 ) - ((ccpulse.group("% Time Spent").statistic("Total_Not_Ready_Time 1") / 60) / 60)

but not for :

result.Long =((ccpulse.group("% Time Spent").statistic("Total_Talk_Time_Inbound 1") + ccpulse.group("% Time Spent").statistic("Total_Ringing_Time 1") + ccpulse.group("% Time Spent").statistic("Total_Hold_Time 1") + ccpulse.group("% Time Spent").statistic("Total_Consult_Talk_Time 1") + ccpulse.group("% Time Spent").statistic("Total_AfterCallWork_Agent_St_Time 1") ) / ccpulse.group("Total Number").Inbound )

Thanks,

WA
Title: Re: CCPulse formula decimal places
Post by: ecki on October 13, 2009, 08:55:51 PM
So, what are you getting? Decimal number or error?
Title: Re: CCPulse formula decimal places
Post by: PFCCWA on October 15, 2009, 03:53:39 PM
Hello,

Whichever combination I try, the following error populates:

Error in formula : overflow
line 0, column 0

Thanks,

WA
Title: Re: CCPulse formula decimal places
Post by: ecki on October 15, 2009, 07:06:01 PM
So and what has happened when you tried round function Math.round() ???
Title: Re: CCPulse formula decimal places
Post by: PFCCWA on November 07, 2009, 01:22:02 PM
How do I use the math round formula with the formula above?

Thanks,
Title: Re: CCPulse formula decimal places
Post by: ecki on November 08, 2009, 08:20:55 AM
Exactly as I described.
result.Long = Math.round((ccpulse.group("% Time Spent").statistic("Total_Talk_Time_Inbound 1") + ccpulse.group("% Time Spent").statistic("Total_Ringing_Time 1") + ccpulse.group("% Time Spent").statistic("Total_Hold_Time 1") + ccpulse.group("% Time Spent").statistic("Total_Consult_Talk_Time 1") + ccpulse.group("% Time Spent").statistic("Total_AfterCallWork_Agent_St_Time 1") ) / ccpulse.group("Total Number").Inbound )
Title: Re: CCPulse formula decimal places
Post by: borkokrz on November 08, 2009, 02:58:36 PM
[quote author=PFCCWA link=topic=4767.msg21328#msg21328 date=1255453273]

result.Long =((ccpulse.group("% Time Spent").statistic("Total_Talk_Time_Inbound 1") + ccpulse.group("% Time Spent").statistic("Total_Ringing_Time 1") + ccpulse.group("% Time Spent").statistic("Total_Hold_Time 1") + ccpulse.group("% Time Spent").statistic("Total_Consult_Talk_Time 1") + ccpulse.group("% Time Spent").statistic("Total_AfterCallWork_Agent_St_Time 1") ) / ccpulse.group("Total Number").Inbound )

[/quote]

The divisor may be equal 0 and this is causing Overflown error message. 
Title: Re: CCPulse formula decimal places
Post by: ecki on November 08, 2009, 09:53:43 PM
Yes, but this will not make the whole calculation inoperable. CCpulse will show something in cases of 0 division error.
Title: Re: CCPulse formula decimal places
Post by: borkokrz on November 09, 2009, 06:18:05 AM
if you change divisor from ccpulse.group("Total Number").Inbound ) to ccpulse.group("Total Number").Inbound )[b]+1[/b], this make whole folmula valid. Of course this +1 have impact on formula results, especialy if this statistic is low value.
Title: Re: CCPulse formula decimal places
Post by: ecki on November 09, 2009, 09:27:10 AM
well you can alway do something like

result.Duration = Math.round(ccpulse.group("Total Number").Inbound  == 0 ? 0 : ccpulse.group("Total Time").Inbound /ccpulse.group("Total Number").Inbound )

or more complex

result.Duration = CalculationDuration();
function CalculationDuration(){
var num = ccpulse.group("Total Time").Inbound;
var den = ccpulse.group("Total Number").Inbound;
return den == 0 ? 0 : Math.round( num / den );
}