Add Method (UtilState)
- Last UpdatedNov 06, 2025
- 5 minute read
The Add() method adds a utilization state record to the Util_State table.
'Declaration
Public Shared Sub Add( _
ByVal sessionId As Integer, _
ByVal stateDesc As String, _
ByVal color As Integer, _
ByVal runtime As Nullable(Of Boolean), _
ByVal downtime As Nullable(Of Boolean), _
ByVal setuptime As Nullable(Of Boolean), _
ByVal teardownTime As Nullable(Of Boolean), _
ByVal fixedtime As Nullable(Of Boolean), _
ByVal vartime As Nullable(Of Boolean), _
ByVal failure As Nullable(Of Boolean), _
ByVal defLabCode As DBString, _
ByVal priority As Nullable(Of Integer), _
ByVal maxDuration As Nullable(Of Integer), _
ByVal newReasonCode As Nullable(Of Integer), _
ByVal standardTime As Nullable(Of Double), _
ByVal minTime As Nullable(Of Double), _
ByVal maxTime As Nullable(Of Double), _
ByVal entityEnabled As DBInt, _
ByVal category1 As DBString, _
ByVal category2 As DBString, _
ByVal category3 As DBString, _
ByVal category4 As DBString, _
ByVal lastEditComment As DBString, _
ByRef stateCd As Integer, _
ByRef lastEditAt As Date _
)
'Usage
Dim sessionId As Integer
Dim stateDesc As String
Dim color As Integer
Dim runtime As Nullable(Of Boolean)
Dim downtime As Nullable(Of Boolean)
Dim setuptime As Nullable(Of Boolean)
Dim teardownTime As Nullable(Of Boolean)
Dim fixedtime As Nullable(Of Boolean)
Dim vartime As Nullable(Of Boolean)
Dim failure As Nullable(Of Boolean)
Dim defLabCode As DBString
Dim priority As Nullable(Of Integer)
Dim maxDuration As Nullable(Of Integer)
Dim newReasonCode As Nullable(Of Integer)
Dim standardTime As Nullable(Of Double)
Dim minTime As Nullable(Of Double)
Dim maxTime As Nullable(Of Double)
Dim entityEnabled As DBInt
Dim category1 As DBString
Dim category2 As DBString
Dim category3 As DBString
Dim category4 As DBString
Dim lastEditComment As DBString
Dim stateCd As Integer
Dim lastEditAt As Date
UtilState.Add(sessionId, stateDesc, color, runtime, downtime, setuptime, teardownTime, fixedtime, vartime, failure, defLabCode, priority, maxDuration, newReasonCode, standardTime, minTime, maxTime, entityEnabled, category1, category2, category3, category4, lastEditComment, stateCd, lastEditAt)
public static void Add(
int sessionId,
string stateDesc,
int color,
Nullable<bool> runtime,
Nullable<bool> downtime,
Nullable<bool> setuptime,
Nullable<bool> teardownTime,
Nullable<bool> fixedtime,
Nullable<bool> vartime,
Nullable<bool> failure,
DBString defLabCode,
Nullable<int> priority,
Nullable<int> maxDuration,
Nullable<int> newReasonCode,
Nullable<double> standardTime,
Nullable<double> minTime,
Nullable<double> maxTime,
DBInt entityEnabled,
DBString category1,
DBString category2,
DBString category3,
DBString category4,
DBString lastEditComment,
out int stateCd,
out DateTime lastEditAt
)
Parameters
- sessionId
- Required. Holds the session ID and thus the user who is calling this method.
- stateDesc
- Required. Holds the unique description for the state.
- color
- Required. Holds an integer that indicates the state's RGB background color in the user interface.
- runtime
- Required. Holds a flag that, if set to true, specifies that the utilization reason counts toward runtime events.
- downtime
- Required. Holds a flag that, if set to true, specifies that the utilization reason counts toward downtime events.
- setuptime
- Required. Holds a flag that, if set to true, specifies that the utilization reason counts toward setup time events.
- teardownTime
- Required. Holds a flag that, if set to true, specifies that the utilization reason counts toward teardown time events.
- fixedtime
- Required. Holds a flag that, if set to true, specifies that the utilization reason counts toward fixed time events.
- vartime
- Required. Holds a flag that, if set to true, specifies that the utilization reason counts toward variable time events.
- failure
- Required. Holds a flag that, if set to true, specifies that any time that the entity spends in the utilization reason code is considered failure time.
- defLabCode
- Optional. Holds the default labor code to be used for the utilization reason when it is manually selected.
- priority
- Required. Holds the utilization reason's priority, which is used to determine the reason for a line that has two or more bottleneck entities with differing reasons.
- maxDuration
Optional. Holds the maximum duration, in seconds, that is used with setting a Severe flag or with the newReasonCode parameter.
- If the newReasonCode parameter is not being used (that is, it is null) and the maximum duration is exceeded, the reason is marked as being Severe and the event is considered to be in a severe condition. The Severe flag is typically used with downtime events.
- If the newReasonCode parameter is being used and the maximum duration is exceeded, the utilization reason for the entity is changed to the new reason specified in the newReasonCode parameter.
- newReasonCode
- Optional. Holds the utilization reason to which this reason should change when the maximum duration is exceeded.
- standardTime
- Optional. Holds the standard amount of time, in minutes, that an entity is expected to be in this utilization reason.
- minTime
- Optional. Holds the minimum amount of time, in minutes, that an entity is expected to be in this utilization reason.
- maxTime
- Optional. Holds the maximum amount of time, in minutes, that an entity is expected to be in this utilization reason.
- entityEnabled
- Optional. Holds a flag that, if set to true, specifies that the utilization reason indicates that any entity with this reason is enabled.
- category1
- Optional. Holds a user-defined field that describes a category.
- category2
- Optional. Holds a user-defined field that describes a category.
- category3
- Optional. Holds a user-defined field that describes a category.
- category4
- Optional. Holds a user-defined field that describes a category.
- lastEditComment
- Optional. Holds comments that describe why this record is being added.
- stateCd
- Output. Holds the returned code that uniquely identifies the state.
- lastEditAt
- Output. Holds the returned date/time when this record was added. The lastEditAt parameter is used by other methods that modify or delete this record for optimistic concurrency control.
Observe the following input parameter rules:
- Required non-DB* parameters: Must pass a value. Cannot be empty or null.
- Optional non-DB* parameters: Either enter a value or pass a null. If passing a null and a default value has been defined, the default value will be used for the parameter.
- Required DB* parameters: Must pass a value. To enter an empty value for the parameter, pass DB*.null (e.g., DBInt.null).
- Optional DB* parameters: To enter no value for the parameter, pass DB*.null (e.g., DBInt.null). To use the default value for the parameter if one has been defined for the object being added, pass a null.
Each utilization reason is assigned a corresponding utilization state. In addition to the state's description and background color, the utilization state includes default settings that can be specified for the utilization reasons to which a utilization state is assigned. These default settings can then be applied in the user interface to the utilization reason. To not specify a default value for a utilization reason setting, pass a null for that parameter.