Hi, I will try to be a bit more specific..
I want to know the value for InteractionsEntered.
First I get the desired "attribute" to watch from the StatisticCatalog:
StatisticCatalog catalog = new StatisticCatalog(_StatisticsManager);
catalog.StartWatching();
ReadOnlyCollection<StatisticDefinition> statistics = catalog.GetStatisticDefinitions();
foreach (StatisticDefinition statistic in statistics)
{
if (statistic.Id.Uri == "ININ.Workgroup:InteractionsEntered")
{
id_InteractionsToday = statistic.Id;
}
}
catalog.StopWatching();
Then I set a watch to get the exact value for InteractionsEntered, for the workgroup in _sWorkgroupName, with given inputs (workgroup and interval):
public void setInteractionsEntered()
{
try
{
ParameterTypeId id_Length = new ParameterTypeId("ININ.Queue:Interval");
ParameterTypeId id_Workgroup = new ParameterTypeId("ININ.People.WorkgroupStats:Workgroup");
ParameterValueKeyedCollection _ParameterValueKeyedCollection = new ParameterValueKeyedCollection();
_ParameterValueKeyedCollection.Add(new ParameterValue(id_Workgroup, _sWorkgroupName));
_ParameterValueKeyedCollection.Add(new ParameterValue(id_Length, "5000"));
StatisticListener listener = new StatisticListener(_StatisticsManager);
StatisticKey watchedKeyInteractionsEntered = new StatisticKey(id_InteractionsToday, _ParameterValueKeyedCollection);
StatisticValue statValue;
listener.StartWatching(new[] { watchedKeyInteractionsEntered });
statValue = listener[watchedKeyInteractionsEntered];
if (!statValue.IsError && !statValue.IsNull)
{
StatisticIntValue intValue = (StatisticIntValue) statValue;
MessageBox.Show(intValue.Value.ToString());
_InteractionsToday = intValue.Value;
}
listener.StopWatching();
}
catch (Exception ex)
{
Tracing.TraceException(ex, "An exception occurred in setAvgWaitTime" + ex.Message.ToString());
}
}
I don't see any errors, but when debugging, I see that !statValue.IsNull is ALWAYS true, and the value is zero, even though I know it should have a positive value. Any thoughts on how to go with this is appreciated.
Regards Mari