GetCountsAndDuration Method (UtilLog)
- Last UpdatedNov 06, 2025
- 4 minute read
The GetCountsAndDuration() method returns a DataSet containing one row for each utilization state, reason group, or reason for the specified entity. It has columns for the ID, description, count or duration, color (valid only for utilization states and reasons), and an active flag that is set true for the current utilization state, reason group, or reason.
This method also includes OEE status, utilization state ID, and reason group ID filters.
'Declaration
Public Shared Function GetCountsAndDuration( _
ByVal sessionId As Integer, _
ByVal entId As Integer, _
ByVal graphType As CountsAndDurationGraphType, _
ByVal filterType As FilterType, _
ByVal filterDuration As Nullable(Of Integer), _
ByVal filterTimeUnit As FilterTimeUnit, _
ByVal filterStartOffset As Nullable(Of Integer), _
ByVal filterEndOffset As Nullable(Of Integer), _
ByVal oeeStatusFilter As OeeStatusFilter, _
ByVal utilStateCode As Nullable(Of Integer), _
ByVal reasGrpId As Nullable(Of Integer) _
) As DataSet
'Usage
Dim sessionId As Integer
Dim entId As Integer
Dim graphType As CountsAndDurationGraphType
Dim filterType As FilterType
Dim filterDuration As Nullable(Of Integer)
Dim filterTimeUnit As FilterTimeUnit
Dim filterStartOffset As Nullable(Of Integer)
Dim filterEndOffset As Nullable(Of Integer)
Dim oeeStatusFilter As OeeStatusFilter
Dim utilStateCode As Nullable(Of Integer)
Dim reasGrpId As Nullable(Of Integer)
Dim value As DataSet
value = UtilLog.GetCountsAndDuration(sessionId, entId, graphType, filterType, filterDuration, filterTimeUnit, filterStartOffset, filterEndOffset, oeeStatusFilter, utilStateCode, reasGrpId)
public static DataSet GetCountsAndDuration(
int sessionId,
int entId,
CountsAndDurationGraphType graphType,
FilterType filterType,
Nullable<int> filterDuration,
FilterTimeUnit filterTimeUnit,
Nullable<int> filterStartOffset,
Nullable<int> filterEndOffset,
OeeStatusFilter oeeStatusFilter,
Nullable<int> utilStateCode,
Nullable<int> reasGrpId
)
Parameters
- sessionId
- Required. Holds the session ID and thus the user who is making this method call. Although required, the session ID is not used by the call.
- entId
Required. Holds the ID of the entity whose counts and duration data is being retrieved.
- graphType
Required. Holds a CountsAndDurationGraphType enumeration value that specifies the type of data that is shown in the Pareto graph of the KPI control. For more information, see the CountsAndDurationGraphType enumeration help topic for the FactMES.API.Util namespace.
- filterType
Required. Holds a FilterType enumeration value that specifies the type of data to filter. For more information, see the FilterType enumeration help topic for the FactMES.API.Util namespace.
- filterDuration
Required if filterType is set to LastNHours. Holds an integer value that specifies the value of N if filterType is LastNHours.
- filterTimeUnit
Required. Holds a FilterTimeUnit enumeration value that specifies the time unit for a custom filter if filterType is Custom. For more information, see the FilterTimeUnit enumeration help topic for the FactMES.API.Util namespace.
- filterStartOffset
Required when filterType is set to Custom. The filter_start_offset and the filter_end_offset together define an interval that filters the data to be returned (i.e., only data which falls within the interval will be returned). These offsets both go backwards from the current time: a value of 1 indicates the current time, a value of 2 indicates one time unit ago, etc.
The filter_start_offset must be greater (i.e., further back in time) than the filter_end_offset. If the filter_end_offset is zero, it is ignored (i.e., the end of the interval will be the current time). For example, if filter_time_unit is set to 2 (Day), filter_start_offset is set to 2 and filter_end_offset is set to 1, then only data with an event time that occurred yesterday will be returned. If filter_time_unit is set to 1 (Shift), filter_start_offset is set to 1, and filter_end_offset is set to 0, then only events that occurred during the current shift will be returned.
- filterEndOffset
Required when filter_time_unit is specified. Specifies the end point of the time interval for which the events are to be filtered. See filter_start_offset for more information.
- oeeStatusFilter
Required. Holds an OEEStatusFilter enumeration value that specifies whether the data should be filtered by an OEE status of runtime, downtime, neither, or all. For more information, see the OeeStatusFilter enumeration help topic for the FactMES.API.Util namespace.
- utilStateCode
- Optional filter parameter. Holds the code of the utilization state by which to filter the retrieved data.
- reasGrpId
- Optional filter parameter. Holds the ID of the reason group by which to filter the retrieved data.
Return Value
For the specified entity and graph type, returns a DataSet that contains calculated counts/durations from the Util_History table for each utilization state, reason group, or reason that match the specified filters. If no matching records are found, an empty DataSet is returned.
The columns of the returned DataSet depend on the specified graph type (that is, the CountsAndDurationGraphType enumeration value that was passed in the graphType parameter) and are described below.
UtilStates:
|
Column Name |
Description |
|---|---|
|
state_cd |
The code for the utilization state. |
|
state_desc |
The description of the utiltization state. |
|
color |
The RGB color value associated with the utilization state. |
|
duration |
The sum of the durations for all events that occurred with this utilization state. |
|
util_count |
The number of events that have this utilization state. |
|
active |
A flag that indicates whether one of the events with this utilization state is the current state for the entity. |
ReasonGroups:
|
Column Name |
Description |
|---|---|
|
reas_grp_id |
The ID of the reason group. |
|
reas_grp_desc |
The description of the reason group. |
|
duration |
The sum of the durations for all events that have a utilization reason that is a member of the reason group. |
|
util_count |
The number of events that have a utilization reason that is a member of the reason group. |
|
active |
A flag that indicates whether one of the events with a utilization reason in this reason group is the current event for the entity. |
Reasons:
|
Column Name |
Description |
|---|---|
|
reas_cd |
The code for the utilization reason. |
|
reas_desc |
The description of the utilization reason. |
|
state_cd |
The code for the utilization state. |
|
state_desc |
The description of the utiltization state. |
|
color |
The RGB color value associated with the utilization state. |
|
duration |
The sum of the durations for all events with this utilization reason code. |
|
util_count |
The number of events with this utilization reason code. |
|
active |
A flag that indicates whether one of the events with this utilization reason code is the current event for the entity. |