Jump to: navigation, search

Get Average Statistic Value

The following example requests the average statistic value for a set of targets in the script block and then uses a delay to indicate when this value will become available to the SCXML session.

<scxml version="1.0" xmlns="http://www.w3.org/2005/07/scxml" 
	xmlns:queue="www.genesyslab.com/modules/queue" 
	xmlns:dialog="www.genesyslab.com/modules/dialog" 
	xmlns:statistic="www.genesyslab.com/modules/statistic" 
	initial="initial">
  <state id="initial">
	<transition event="interaction.added" target="subscribe"/>
  </state>
  <state id="subscribe">
	<onentry>
		<statistic:subscribe object="'702_sip@.A'" statistic="'StatAgentsAvailable'"/>
		<statistic:subscribe object="'SipGr_2@.GA'" statistic="'StatAgentsAvailable'"/>
	</onentry>
    
	<transition event="statistic.subscribe.done" target="delay"/>
	<transition event="error.statistic.subscribe" target="error"/>
  </state>
  <state id="delay">
	<onentry>
		<send event="'delay'" target="_sessionid" targettype="'scxml'" delay="'2s'"/>
	</onentry>
	<transition event="delay" target="check"/>
  </state>
  <state id="check">
	<onentry>
		<log expr="_genesys.statistic.sData('702_sip@.A', 'StatAgentsAvailable')"/>
		<log expr="_genesys.statistic.sData('SipGr_2@.GA', 'StatAgentsAvailable')"/>
	</onentry>
	<transition cond="_genesys.statistic.getAvgData('702_sip@.A,SipGr_2@.GA', 'StatAgentsAvailable')==1" target="exit"/>
	<transition cond="_genesys.statistic.getAvgData('702_sip@.A,SipGr_2@.GA', 'StatAgentsAvailable')!=1" target="error"/>
  </state>
  
  <final id="exit"/>
  <final id="error"/>
</scxml>
This page was last edited on August 14, 2014, at 20:21.
Comments or questions about this documentation? Contact us for support!