Genesys CTI User Forum
Genesys CTI User Forum => Genesys CTI Technical Discussion => Topic started 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
-
Hi,
That is Java Script, so you can use something like this Math.round(10.1234)
e.
-
Or you can try formating result. Put this on the beginning.
result.Long =
-
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
-
So, what are you getting? Decimal number or error?
-
Hello,
Whichever combination I try, the following error populates:
Error in formula : overflow
line 0, column 0
Thanks,
WA
-
So and what has happened when you tried round function Math.round() ???
-
How do I use the math round formula with the formula above?
Thanks,
-
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 )
-
[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.
-
Yes, but this will not make the whole calculation inoperable. CCpulse will show something in cases of 0 division error.
-
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.
-
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 );
}