Author Topic: CCPulse formula decimal places  (Read 8423 times)

Offline PFCCWA

  • Hero Member
  • *****
  • Posts: 655
  • Karma: -7
CCPulse formula decimal places
« 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

Offline ecki

  • Sr. Member
  • ****
  • Posts: 329
  • Karma: 8
Re: CCPulse formula decimal places
« Reply #1 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.

Offline ecki

  • Sr. Member
  • ****
  • Posts: 329
  • Karma: 8
Re: CCPulse formula decimal places
« Reply #2 on: October 13, 2009, 02:32:25 PM »
Or you can try formating result. Put this on the beginning.
result.Long =

Offline PFCCWA

  • Hero Member
  • *****
  • Posts: 655
  • Karma: -7
Re: CCPulse formula decimal places
« Reply #3 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

Offline ecki

  • Sr. Member
  • ****
  • Posts: 329
  • Karma: 8
Re: CCPulse formula decimal places
« Reply #4 on: October 13, 2009, 08:55:51 PM »
So, what are you getting? Decimal number or error?

Offline PFCCWA

  • Hero Member
  • *****
  • Posts: 655
  • Karma: -7
Re: CCPulse formula decimal places
« Reply #5 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

Offline ecki

  • Sr. Member
  • ****
  • Posts: 329
  • Karma: 8
Re: CCPulse formula decimal places
« Reply #6 on: October 15, 2009, 07:06:01 PM »
So and what has happened when you tried round function Math.round() ???

Offline PFCCWA

  • Hero Member
  • *****
  • Posts: 655
  • Karma: -7
Re: CCPulse formula decimal places
« Reply #7 on: November 07, 2009, 01:22:02 PM »
How do I use the math round formula with the formula above?

Thanks,

Offline ecki

  • Sr. Member
  • ****
  • Posts: 329
  • Karma: 8
Re: CCPulse formula decimal places
« Reply #8 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 )

Offline borkokrz

  • Full Member
  • ***
  • Posts: 154
  • Karma: 6
Re: CCPulse formula decimal places
« Reply #9 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. 

Offline ecki

  • Sr. Member
  • ****
  • Posts: 329
  • Karma: 8
Re: CCPulse formula decimal places
« Reply #10 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.

Offline borkokrz

  • Full Member
  • ***
  • Posts: 154
  • Karma: 6
Re: CCPulse formula decimal places
« Reply #11 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.

Offline ecki

  • Sr. Member
  • ****
  • Posts: 329
  • Karma: 8
Re: CCPulse formula decimal places
« Reply #12 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 );
}