SetAttr(Int32,String,String,Int32,String,Nullable<Int32>,Nullable<Int32>) Method
- Last UpdatedNov 06, 2025
- 3 minute read
The SetAttr() method sets the value of a job attribute given the entity on which the job is running but not the actual job details.
This overload of the method uses the entity name and site name to specify the entity.
'Declaration
Public Overloads Shared Sub SetAttr( _
ByVal sessionId As Integer, _
ByVal entName As String, _
ByVal siteName As String, _
ByVal attrId As Integer, _
ByVal attrValue As String, _
ByVal jobPos As Nullable(Of Integer), _
ByVal bomPos As Nullable(Of Integer) _
)
'Usage
Dim sessionId As Integer
Dim entName As String
Dim siteName As String
Dim attrId As Integer
Dim attrValue As String
Dim jobPos As Nullable(Of Integer)
Dim bomPos As Nullable(Of Integer)
JobExec.SetAttr(sessionId, entName, siteName, attrId, attrValue, jobPos, bomPos)
public static void SetAttr(
int sessionId,
string entName,
string siteName,
int attrId,
string attrValue,
Nullable<int> jobPos,
Nullable<int> bomPos
)
Parameters
- sessionId
- Required. Holds the session ID and thus the user who is making this method call.
- entName
- Required. Holds the name of the entity on which the job attribute is being collected. This value is used to find the current job running on the entity to identify the correct record to update in the Job_Attr table.
- siteName
- Optional. Holds the site name of the entity.
- attrId
- Required. Holds the ID of the attribute whose value is being set.
- attrValue
- Required. Holds the actual attribute value to be saved.
- jobPos
- Optional. Holds the job position. If greater than 1, jobs are running on this entity.
- bomPos
- Optional. Holds the BOM position.
This method facilitates capturing job attribute values from a PLC, even if job currently running on the entity is not known. This method first extracts the attribute group from the supplied attribute to determine the *_Attr table to be updated.
- If the supplied attribute is linked to an item attribute group (grp_id = 1), then the item from the supplied job BOM component for the supplied BOM position for the job that is currently running on the supplied entity at job position 0 is updated with the supplied attribute value.
- If the supplied attribute is linked to an entity attribute group (grp_id = 2), then the supplied attribute value is updated to the supplied entity with the supplied attribute value.
- If the supplied attribute is linked to the job attribute group (grp_id = 5), then the supplied attribute value is updated for the job that is currently running on the supplied entity at job position 0 with the supplied attribute value.
For the method to succeed, the following must be true:
- If the supplied attribute is linked to item attribute group, there is a job currently running at job position 0.
- If the supplied attribute is linked to item attribute group, the supplied attribute is linked to the supplied item.
- If the supplied attribute is linked to the entity attribute group, the supplied attribute is linked to the supplied entity.
- If the supplied attribute is linked to job attribute group, there is a job currently running at job position 0.
- If the supplied attribute is linked to job attribute group, the supplied attribute is linked to the supplied job.