GetCountsAndDuration Method (Line)
- Last UpdatedNov 06, 2025
- 4 minute read
'Declaration
Public Shared Function GetCountsAndDuration( _
ByVal lineId As Integer, _
ByVal graphType As LineCountsAndDurationGraphType, _
ByVal filterType As LineFilterType, _
ByVal filterDuration As Nullable(Of Integer), _
ByVal filterTimeUnit As LineFilterTimeUnit, _
ByVal filterStartOffset As Nullable(Of Integer), _
ByVal filterEndOffset As Nullable(Of Integer), _
ByVal oeeStatusFilter As LineOeeStatusFilter, _
ByVal utilStateCode As Nullable(Of Integer), _
ByVal reasGrpId As Nullable(Of Integer) _
) As DataSet
'Usage
Dim lineId As Integer
Dim graphType As LineCountsAndDurationGraphType
Dim filterType As LineFilterType
Dim filterDuration As Nullable(Of Integer)
Dim filterTimeUnit As LineFilterTimeUnit
Dim filterStartOffset As Nullable(Of Integer)
Dim filterEndOffset As Nullable(Of Integer)
Dim oeeStatusFilter As LineOeeStatusFilter
Dim utilStateCode As Nullable(Of Integer)
Dim reasGrpId As Nullable(Of Integer)
Dim value As DataSet
value = Line.GetCountsAndDuration(lineId, graphType, filterType, filterDuration, filterTimeUnit, filterStartOffset, filterEndOffset, oeeStatusFilter, utilStateCode, reasGrpId)
public static DataSet GetCountsAndDuration(
int lineId,
LineCountsAndDurationGraphType graphType,
LineFilterType filterType,
Nullable<int> filterDuration,
LineFilterTimeUnit filterTimeUnit,
Nullable<int> filterStartOffset,
Nullable<int> filterEndOffset,
LineOeeStatusFilter oeeStatusFilter,
Nullable<int> utilStateCode,
Nullable<int> reasGrpId
)
Parameters
- lineId
Required. Holds the ID of the line whose counts and duration data are being retrieved.
- graphType
Required. Holds a LineCountsAndDurationGraphType enumeration value that specifies the type of data that is shown in the Pareto graph of the KPI control. For more information, see the LineCountsAndDurationGraphType enumeration help topic for the FactMES.API.Core namespace.
- filterType
Required. Holds a LineFilterType enumeration value that specifies the type of time period by which to filter the data. For more information, see the LineFilterType enumeration help topic for the FactMES.API.Core namespace.
- filterDuration
Optional. Holds an integer value that specifies the value of N if filterType is LastNHours.
- filterTimeUnit
Required. Holds a LineFilterTimeUnit enumeration value that specifies the time unit for a custom filter if filterType is Custom. For more information, see the LineFilterTimeUnit enumeration help topic for the FactMES.API.Core namespace.
If filterType is not Custom, this parameter is ignored.
- filterStartOffset
Optional. Holds an integer that specifies the start point of the time interval for which the events are to be filtered. See the Remarks section below for more information about how this parameter is used.
- filterEndOffset
Optional. Specifies the end point of the time interval for which the events are to be filtered. See the Remarks section below for more information about how this parameter is used.
- oeeStatusFilter
Required. Holds a LineOEEStatusFilter enumeration value that specifies whether the data should be filtered by an OEE status of Runtime, Downtime, Neither, or all three statuses. For more information, see the LineOeeStatusFilter enumeration help topic for the FactMES.API.Core namespace.
- utilStateCode
- Optional. Holds the code of the utilization state by which to filter the retrieved data.
- reasGrpId
- Optional. Holds the ID of the utilization reason group by which to filter the retrieved data.
Return Value
For the specified line and graph type, returns a DataSet that contains calculated counts/durations 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 LineCountsAndDurationGraphType 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 line. |
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 line. |
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. |
|
util_count |
The number of events with this utilization reason. |
|
active |
A flag that indicates whether one of the events with this utilization reason is the current event for the entity. |
The filter_start_offset and the filter_end_offset together define an interval that filters the data to be returned (that is, only data that 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 (that is, further back in time) than the filter_end_offset. If the filter_end_offset is 0, it is ignored (that is, 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 the 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 the events that occurred during the current shift will be returned.
Note: Because this method queries historical tables and supports custom time periods, use caution when querying large time periods (greater than a day), as system performance can be adversely affected.