Add Method (SamplePlan)
- Last UpdatedNov 06, 2025
- 3 minute read
The Add() method adds a new sample plan record to the Sample_Plan table.
'Declaration
Public Shared Sub Add( _
ByVal sessionId As Integer, _
ByVal planName As String, _
ByVal planDesc As DBString, _
ByVal categoryId As DBInt, _
ByVal verifiedWrite As Nullable(Of Boolean), _
ByVal sampleName As String, _
ByVal resetOption As Nullable(Of Integer), _
ByVal spare1 As DBString, _
ByVal spare2 As DBString, _
ByVal spare3 As DBString, _
ByVal spare4 As DBString, _
ByVal lastEditComment As DBString, _
ByRef planId As Integer, _
ByRef lastEditAt As Date _
)
'Usage
Dim sessionId As Integer
Dim planName As String
Dim planDesc As DBString
Dim categoryId As DBInt
Dim verifiedWrite As Nullable(Of Boolean)
Dim sampleName As String
Dim resetOption As Nullable(Of Integer)
Dim spare1 As DBString
Dim spare2 As DBString
Dim spare3 As DBString
Dim spare4 As DBString
Dim lastEditComment As DBString
Dim planId As Integer
Dim lastEditAt As Date
SamplePlan.Add(sessionId, planName, planDesc, categoryId, verifiedWrite, sampleName, resetOption, spare1, spare2, spare3, spare4, lastEditComment, planId, lastEditAt)
public static void Add(
int sessionId,
string planName,
DBString planDesc,
DBInt categoryId,
Nullable<bool> verifiedWrite,
string sampleName,
Nullable<int> resetOption,
DBString spare1,
DBString spare2,
DBString spare3,
DBString spare4,
DBString lastEditComment,
out int planId,
out DateTime lastEditAt
)
Parameters
- sessionId
Required. Holds the session ID and thus the user who is making this method call.
- planName
Required. Holds the unique name of the sample plan for display.
The naming convention for sample plan run time is SamplePlanNameYYYYMMDD####, where the ‘YYYYMMDD’ represents the date information, ‘#’ represents the ordinal number used to create uniqueness when the rest of the name (except the date) is the same, and the ‘SamplePlanName’ is taken from the following fields:
sample_plan_name
ent_ name (using ent_id to retrieve the ent_name)
wo_id
oper_id
seq_no
segment_requirement_id
segment_response_id
char_name
qm_spec_name
freq_nameLiteral characters should be enclosed in square brackets [ ],such as a date string yy[-]mm[-]dd.
- planDesc
Optional. Holds a description of the sample plan.
- categoryId
Optional. Holds the unique identifier of the category to which this sample plan belongs.
- verifiedWrite
Optional. Holds a flag that, if set to true, will require an operator confirmation of manually entered values.
- sampleName
Optional. Holds a pattern sample names are to follow. Default is "SamplePlanNameYYYYMMDD####"
- resetOption
Optional. Holds the option for reseting the octothorpe part(#) of a sample plan name back to 1. Default is Never. 0 (default) = nothing (never resets), 1 = change in local date.
- spare1
Optional. Holds the contents of the user-defined spare1 field.
- spare2
Optional. Holds the contents of the user-defined spare2 field.
- spare3
Optional. Holds the contents of the user-defined spare3 field.
- spare4
Optional. Holds the contents of the user-defined spare4 field.
- lastEditComment
Optional. Holds comments that describe why this record is being added.
- planId
- Output. Holds the ID assigned to this record when it is added. The planId parameter is used by other methods that modify or delete this type of record.
- lastEditAt
- Output. Holds the datetime that this record was added.
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.