" /> Division Formula in IRD Strategy - Genesys CTI User Forum

Author Topic: Division Formula in IRD Strategy  (Read 2544 times)

Offline PFCCWA

  • Hero Member
  • *****
  • Posts: 655
  • Karma: -7
Division Formula in IRD Strategy
« on: December 03, 2014, 04:57:09 PM »
Advertisement
Hello,

Thought this was easy and correct but when using this formula in function block in IRD routing strategy, output values are not what is expected:

variable_1 value is taken from AverageWaitTime (integer)
variable_2 is taken from CurrectWaitTime (integer)
variable_Pct = (Variable_1 / Variable_2 ) * 100

If variable 1 is less than variable 2, urs logs show variable_pct as 0 ie ie 38 / 69 * 100 should equal 55 but is 0.
If variable 1 is greater than variable 2, urs logs show a value but is incorrect ie 124 / 98 * 100 should equal 126 but is 100.

Where is this going wrong.

thanks,

Offline terry

  • Sr. Member
  • ****
  • Posts: 328
  • Karma: 35
Re: Division Formula in IRD Strategy
« Reply #1 on: December 03, 2014, 07:03:39 PM »
If both variables a and b are INTEGER IRD will male "integer division" for a/b (exactly what you get in C/C++ -
in case of int a = 1; int b = 2; int z= a/b; ).
If you need fraction use FLOAT variables or change order Variable_1 *100 / Variable_2

Offline PFCCWA

  • Hero Member
  • *****
  • Posts: 655
  • Karma: -7
Re: Division Formula in IRD Strategy
« Reply #2 on: December 04, 2014, 09:43:41 AM »
thanks , changing the formula around has worked.