" /> Force an Action to fire/Have Threshold apply even if statistic doesn't change - Genesys CTI User Forum

Author Topic: Force an Action to fire/Have Threshold apply even if statistic doesn't change  (Read 2021 times)

Offline molkemon

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Advertisement
Hello,

I am using ccpulse. I know what I'm doing could also be done with CCAnalyze or getting data directly from the statserver, but both of those are not doable by me at this moment, it has to be done in ccpulse.


I have a formula that puts several statistics of a VQ object into a csv string (like "N_CURR_WAIT;OCN;ANS;AHT;SVL")... you get the idea.

I have also written an Action that writes the value of this string into a .csv file (it first checks if the specific VQ Object eg "VQ_Spanish" already exists in the file and if yes, it overwrites the line and if not, it adds the VQ and its values as a new line.

All this works fine, however I face a very specific problem now:

In order to actually make the Action fire, I of course need a Threshold. I have written several, but for simplicity, let's take this one:

[code]
if Minute(Now) mod 2 = 0 then
Threshold.Result = true
else
Threshold.Result = false
end if
[/code]

So the Threshold is true every even minute of the hour and false every odd minute.  So far so good. I now apply this Threshold to the Export String Formula, but now I have the following problem: In order for the action to fire, not only must the minute of the hour be even, but also, the formula has to recalculate during this period (if no one is calling on that VQ during the minute or no other statistic changes, nothing happens). Also, in order to later fire the Action again, the Formula also has to recalculate during an odd minute of the hour, so it sets the Threshold to false and be ready, to set it to true again later and fire the action again.

This works fine for queues with constant activity, but it creates problems for VQs with very little activity (maybe 10 calls a day). I am already using a different Threshold, where true and false alternates every 5 seconds, but even then values of VQs with very little activity are not always reliably recalculated both during the true and false interval, which results the export file showing e.g. one waiting call on that VQ, even though the last call happened several hours ago.

Is there a way to force recalculate a formula even when no statistic changes? Or to force fire an Action after a set time interval without the need to have a Threshold be true?
« Last Edit: May 18, 2017, 10:41:29 AM by molkemon »

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7641
  • Karma: 56330
Do a while 1 = 1 every X seconds you need. Guess that would work.
Why not CCA directly?

Offline molkemon

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Hello, I started out with while 1=1, however, this results in the Threshold to always be true, which results in the Action only firing once. An action apparently only fires the very moment the value of the stat/formula to which the Threshold is applied changes while the Threshold is true, and only if the object was still on the "false" state before. If the Threshold is always true, it will never fire again after the first time, that's why I'm alternating between true/false states. Unless I'm missing something here.

To clarify, take a simple action like color = yellow and my Threshold I posted earlier which is true during even minutes and false during odd minutes.

You would expect that every object the Threshold is applied to gets colored yellow the moment the minute switches from odd to even, and then switches back to default color on the next minute change. However, this is not the case at all. Only if an object which has the Threshold applied to changes it's value WHILE the threshold is true (so for example on xx:02:23 a new call is offered) will result in it being colored yellow, and after that you have to first have a change on the stat while the Threshold is false so the color can revert to default, and then later to yellow again...

I also tried to have the action itself constantly loop, but this just makes ccpulse freeze up.

I do not have admin privs for statserver/datamart, only full privliges in ccpulse itself.
« Last Edit: May 18, 2017, 04:53:41 PM by molkemon »

Offline molkemon

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
I found a solution to this problem:

To reillustrate the issue: You cannot continously fire an action while a threshold remains true - the action will only fire the first time the threshhold evaluates true.

Like:
-Load Workspace
-Threshold Evaluates True --> Action fires
-Threshold Evaluates True --> nothing happens
-Threshold Evaluates True --> nothing happens
-Threshold Evaluates True --> nothing happens
-Threshold Evaluates True --> nothing happens
-Threshold Evaluates False--> nothing happens
-Threshold Evaluates True --> Action fires
etc


So up until now I used a threshold that would alternate between true and false every 5 seconds(so it was true for seconds 0-5 of the minute, false for seconds 6-10, true for seconds 11-15 and so on), however this was not accurate enough for objects (VQs) with very little activity and often changes on the VQ would go without the desired action firing.

However, I recently came to a realization: You don't need actions at all. Just write the action code in the threshold itself - it will always execute when you desire it (you can even set up different code for when the threshold evaluates true or false). Note that some predefined objects (like notifier.color) don't work in the threshold, but normal vbscript works just fine.

To set the threshold to an object, CCPulse+ still requires you to choose an action, but you can just make a completely empty one and use that (I called mine do_nothing).

Problem solved :)
« Last Edit: April 19, 2018, 02:13:18 PM by molkemon »