GenerateSampleAsync Method
- Last UpdatedNov 06, 2025
- 3 minute read
The GenerateSampleAsync() asynchronous method adds a new sample to the sample table and creates one or more records in the Sample_Char_Link table.
The GenerateSampleAsync() asynchronous method adds a new sample to the sample table and creates one or more records in the Sample_Char_Link table.
Note: The Suppress Message represents internal code only and is not part of the GenerateSampleAsync method.
'Declaration
<SuppressMessageAttribute("Microsoft.StyleCop.CSharp.NamingRules",
"SA1305 : CSharp.Naming",
Justification="Properties are defined with lower case letters in the interfaces which cannot be edited.")>
Public Shared Sub GenerateSampleAsync( _
ByVal sessionId As Integer, _
ByVal entityName As String, _
ByVal siteName As String, _
ByVal qmSpecName As String, _
ByVal sampleName As String, _
ByVal planName As String, _
ByVal itemId As String, _
ByVal woId As String, _
ByVal operId As String, _
ByVal seqNo As Nullable(Of Integer), _
ByVal qmSpecVersion As String, _
ByVal expInterval As Nullable(Of Integer), _
ByVal warningInterval As Nullable(Of Integer), _
ByVal requestedTimeLocal As Nullable(Of Date) _
)
'Usage
Dim sessionId As Integer
Dim entityName As String
Dim siteName As String
Dim qmSpecName As String
Dim sampleName As String
Dim planName As String
Dim itemId As String
Dim woId As String
Dim operId As String
Dim seqNo As Nullable(Of Integer)
Dim qmSpecVersion As String
Dim expInterval As Nullable(Of Integer)
Dim warningInterval As Nullable(Of Integer)
Dim requestedTimeLocal As Nullable(Of Date)
Sample.GenerateSampleAsync(sessionId, entityName, siteName, qmSpecName, sampleName, planName, itemId, woId, operId, seqNo, qmSpecVersion, expInterval, warningInterval, requestedTimeLocal)
[SuppressMessage("Microsoft.StyleCop.CSharp.NamingRules",
"SA1305 : CSharp.Naming",
Justification="Properties are defined with lower case letters in the interfaces which cannot be edited.")]
public static void GenerateSampleAsync(
int sessionId,
string entityName,
string siteName,
string qmSpecName,
string sampleName,
string planName,
string itemId,
string woId,
string operId,
Nullable<int> seqNo,
string qmSpecVersion,
Nullable<int> expInterval,
Nullable<int> warningInterval,
Nullable<DateTime> requestedTimeLocal
)
Parameters
- sessionId
- Required. Holds the session ID and thus the user who is making this method call.
- entityName
- Required. Holds the name of the entity of a sample.
- siteName
- Optional. Holds the name of the site to which the supplied entity belongs. Must be null if sites are not being used.
- qmSpecName
- Required. Holds the name of the QM specification.
- sampleName
- Optional. Holds the name of the sample (created according to sample_plan.sample_name).
- planName
- Optional. Holds the name of the sample plan for display.
- itemId
- Optional. Holds the ID of the item from which the sample was generated.
- woId
- Optional. Hold the ID of the work order of the job for which the sample was generated.
- operId
- Optional. Hold the ID of the operation of the job for which the sample was generated.
- seqNo
- Optional. Hold the ID of the sequence number for the job for which the sample was generated.
- qmSpecVersion
- Optional. Holds the QM specification version.
- expInterval
- Optional. Holds the amount of time, in minutes, to wait for a sample to be pulled before changing its status to MISSED; default = 10. Null = no expiration.
- warningInterval
- Optional. Holds the amount of time, in minutes, to wait for a sample to be pulled before changing its status to READY WARNING; default = 5. Null = no warning
- requestedTimeLocal
- Optional. Holds the local time when the sample was requested (readied).
This method creates a new manual sample for the provided entity based on the provided QM Specification name and optional parameters.
- If only the QM Specification Name is provided, the system will look for a Manual Sample plan frequency linked to the QM Spec’s sample plan and, if none exist, then any defined manual frequency in the system, which will be used as the frequency for the sample.
- If an optional sample plan name is provided, the system will use this and look for any manual frequencies associated to the provided sample plan. In this manner, there can be a single sample plan with the manual frequency associated to it for use by all QM Specifications using this method call.
- If an optional sample name is provided, it will be used in place of the system generating a sample name based on either the provided sample plan name or the default sample plan associated to the QM Specification.
- If the requested time local is provided, it must be the current time or time in the past. When not provided, the system will use the current time.