Clone(Int32,Int32,String,DBString,DBInt,DBInt,DBDouble,Nullable<Boolean>,Nullable<Boolean>,Nullable<Boolean>,Nullable<Boolean>,Nullable<Boolean>,Nullable<Boolean>,Nullable<Boolean>,Nullable<Boolean>,Nullable<Boolean>,Nullable<Boolean>,Nullable<Boolean>,Nullable<Boolean>,DBInt,DBDateTime,DBDateTime,DBString,Nullable<Boolean>,DBString,Int32,DateTime) Method
- Last UpdatedMar 17, 2026
- 7 minute read
The Clone() method adds a new entity to the Ent table that is based on a specified existing entity.
'Declaration
Public Overloads Shared Sub Clone( _
ByVal sessionId As Integer, _
ByVal existingEntId As Integer, _
ByVal entName As String, _
ByVal description As DBString, _
ByVal parentEntId As DBInt, _
ByVal site As DBInt, _
ByVal hourlyCost As DBDouble, _
ByVal canSchedJobs As Nullable(Of Boolean), _
ByVal canRunJobs As Nullable(Of Boolean), _
ByVal canCaptureUtil As Nullable(Of Boolean), _
ByVal canCaptureLabor As Nullable(Of Boolean), _
ByVal canDoDNC As Nullable(Of Boolean), _
ByVal canTrackOEE As Nullable(Of Boolean), _
ByVal canSchedShifts As Nullable(Of Boolean), _
ByVal canStore As Nullable(Of Boolean), _
ByVal canLogData As Nullable(Of Boolean), _
ByVal canShip As Nullable(Of Boolean), _
ByVal canReceive As Nullable(Of Boolean), _
ByVal canCopyFolders As Nullable(Of Boolean), _
ByVal curShiftId As DBInt, _
ByVal curShiftStartTimeLocal As DBDateTime, _
ByVal lastDomainChange As DBDateTime, _
ByVal treeIcon As DBString, _
ByVal showInDSPTree As Nullable(Of Boolean), _
ByVal lastEditComment As DBString, _
ByRef entId As Integer, _
ByRef lastEditAt As Date _
)
'Usage
Dim sessionId As Integer
Dim existingEntId As Integer
Dim entName As String
Dim description As DBString
Dim parentEntId As DBInt
Dim site As DBInt
Dim hourlyCost As DBDouble
Dim canSchedJobs As Nullable(Of Boolean)
Dim canRunJobs As Nullable(Of Boolean)
Dim canCaptureUtil As Nullable(Of Boolean)
Dim canCaptureLabor As Nullable(Of Boolean)
Dim canDoDNC As Nullable(Of Boolean)
Dim canTrackOEE As Nullable(Of Boolean)
Dim canSchedShifts As Nullable(Of Boolean)
Dim canStore As Nullable(Of Boolean)
Dim canLogData As Nullable(Of Boolean)
Dim canShip As Nullable(Of Boolean)
Dim canReceive As Nullable(Of Boolean)
Dim canCopyFolders As Nullable(Of Boolean)
Dim curShiftId As DBInt
Dim curShiftStartTimeLocal As DBDateTime
Dim lastDomainChange As DBDateTime
Dim treeIcon As DBString
Dim showInDSPTree As Nullable(Of Boolean)
Dim lastEditComment As DBString
Dim entId As Integer
Dim lastEditAt As Date
Ent.Clone(sessionId, existingEntId, entName, description, parentEntId, site, hourlyCost, canSchedJobs, canRunJobs, canCaptureUtil, canCaptureLabor, canDoDNC, canTrackOEE, canSchedShifts, canStore, canLogData, canShip, canReceive, canCopyFolders, curShiftId, curShiftStartTimeLocal, lastDomainChange, treeIcon, showInDSPTree, lastEditComment, entId, lastEditAt)
public static void Clone(
int sessionId,
int existingEntId,
string entName,
DBString description,
DBInt parentEntId,
DBInt site,
DBDouble hourlyCost,
Nullable<bool> canSchedJobs,
Nullable<bool> canRunJobs,
Nullable<bool> canCaptureUtil,
Nullable<bool> canCaptureLabor,
Nullable<bool> canDoDNC,
Nullable<bool> canTrackOEE,
Nullable<bool> canSchedShifts,
Nullable<bool> canStore,
Nullable<bool> canLogData,
Nullable<bool> canShip,
Nullable<bool> canReceive,
Nullable<bool> canCopyFolders,
DBInt curShiftId,
DBDateTime curShiftStartTimeLocal,
DBDateTime lastDomainChange,
DBString treeIcon,
Nullable<bool> showInDSPTree,
DBString lastEditComment,
out int entId,
out DateTime lastEditAt
)
Parameters
- sessionId
- Required. Holds the session ID and thus the user who is making this method call.
- existingEntId
- Required. Holds the ID of the source entity on which to base the new entity that is being added.
- entName
- Required. Holds the name of the new entity.
- description
- Optional. Holds the description for the new entity.
- parentEntId
- Optional. Holds the ID of the parent entity for the new entity. If this parameter's value is DBInt.null, this entity will be cloned as a root entity.
- site
- Optional. Holds the ID of the ancestor entity that defines the site at which this entity is located. If null, the entity is above sites or sites are not being used in the system.
- hourlyCost
- Optional. Holds the cost of running this entity per hour.
- canSchedJobs
- Optional. Holds a flag that, if set to true, specifies that jobs can be scheduled to this entity.
- canRunJobs
- Optional. Holds a flag that, if set to true, specifies that jobs can be run on this entity.
- canCaptureUtil
- Optional. Holds a flag that, if set to true, specifies that this entity can capture utilization, subject to the number of available licenses.
- canCaptureLabor
- Optional. Holds a flag that, if set to true, specifies that this entity can capture labor data.
- canDoDNC
- Optional. Not used. Will always be set to False.
- canTrackOEE
- Optional. Holds a flag that, if set to true, specifies that this entity can capture OEE statistics.
- canSchedShifts
- Optional. Holds a flag that indicates whether this entity can schedule shifts. If true, this entity will have its own shift schedules. Otherwise, the shift schedules are inherited from its preferred parent or from its nearest ancestor that can schedule shifts.
- canStore
- Optional. Holds a flag that, if set to true, specifies that this entity can store items, and thus this can be used as a storage location.
- canLogData
- Optional. Holds a flag that, if set to true, specifies that this entity can log data.
- canShip
- Optional. Holds a flag that, if set to true, specifies that materials can be shipped from this entity.
- canReceive
- Optional. Holds a flag that, if set to true, specifies that materials can be received at this entity.
- canCopyFolders
- Optional. Holds a flag that, if set to true, specifies that the files in folders for this entity can be copied to its download directories.
- curShiftId
Optional. Holds the ID of the current shift for this entity. If the can_sched_shifts property for an entity is set to false, then the current shift ID and the current shift datetimes are inherited from the nearest ancestor entity (through preferred ancestor hierarchy) that can schedule shifts; otherwise the current shift ID is set to 0.
Note: This parameter is currently not used.
- curShiftStartTimeLocal
Optional. Holds the date/time of the current shift start time for this entity, in local time. If the can_sched_shifts property for an entity is set to false, then the current shift ID and the current shift datetimes are inherited from the nearest ancestor entity (through preferred ancestor hierarchy) that can schedule shifts; otherwise, the current shift start time is set to the current date and time when the entity is created.
Note: This parameter is currently not used.
- lastDomainChange
- Optional. Holds the date/time of the last domain change.
Note: This parameter is currently not used.
- treeIcon
Optional. Holds a string that is the key for retrieving the hierarchy tree icon image from the Graphics table. If null, a default image will be used.
Note: This parameter is currently not used.
- showInDSPTree
Optional. Holds a flag that, if set to true, specifies that the entity is shown in the tree for the data source plug-in.
Note: This parameter is obsolete.
- lastEditComment
- Optional. Holds comments about why this record is being added.
- entId
- Output. Holds the returned entity ID for this new entity.
- lastEditAt
Holds the returned date/time when this record was created. The lastEditAt parameter is used in other methods that modify or delete this type of record for optimistic concurrency control.
Observe the following input parameter rules:
- Optional non-DB* parameters: Either enter a new value or leave the existing value unchanged by passing a null.
- Optional DB* parameters: To clear the existing value and enter an empty value, pass DB*.null (e.g., DBInt.null). To leave the existing value unchanged, pass a null.
This method clones all the data from the existing entity and its child entities identified by the supplied parameter to a new entity and new child entities. Any data existing in the following tables except the current status data will be cloned to the new entity and child entities: Ent_Attr, Shift_Schedule, Shift_Exc, Grp_Ent_Link, Ent_Link, Dir, Job_Exec, Job_Sched_Exec, Oee_Exec, Storage_Exec, Util_Exec, Util_Raw_Reas, Util_Reas_Link, Labor_Exec, Labor_Raw_Reas, and Labor_Reas_Link.
If the supplied canCaptureUtil flag for the new entity is set to true, then the corresponding Middleware method validates whether there are enough licenses available for the new entity prior to adding it. If there are enough licenses in the license file, then the corresponding flag is set to true; otherwise, the corresponding flag is set to false.
The entity names are suffixed with ‘(Clone)’ for all the child entities that are cloned from the existing entity. Subsequently, a corresponding new record is added to Ent_Link table to establish a link between the parent and child entities.
The following records from the existing entity are copied to the new entity and its child entities:
- Ent_Attr: Any attributes linked to the existing entities are copied to the new entities.
- Grp_Ent_Link: All user groups from the Grp_Name table are added to the new entities. Thus, all the user groups will be linked to the new entities with an access permission set to false by default.
- Item_Reas_Grp_Ent_Link: All item reasons groups that are linked to the existing entities are copied to the new entities.
- Dir: All upload/download directories from the existing entities are copied to the new entities.
- CanSchedShifts: If the new entities are capable of scheduling shifts, then all shift schedules from the existing entities (if any) are copied to the new entities. Additionally, any shift exceptions that were scheduled for the existing entities are also copied to the new entities.
- CanRunJobs: If the new entities are capable of running jobs, then all records from the Job_Exec table linking the existing entities except the current status fields (such as cur_wo_id, cur_*) are copied to the new entities. The current status values are set to null by default.
- CanSchedJobs: If the new entities are capable of scheduling jobs, then all records from Job_Sched_Exec table linking the existing entities are copied to the new entities.
- CanTrackOee: If the new entities are capable of tracking OEE, then all records from the Oee_Exec table linking the existing entities are copied to the new entities.
- CanStore: If the new entities are capable of storing materials, then all records from the Storage_Exec table linking the existing entities are copied to the new entities.
- CanCaptureUtil: If the new entities are capable of capturing machine utilization, then all records from the Util_Exec table linking the existing entities are copied to the new entities. Additionally, any default raw reasons (Util_Raw_Reas table) and reasons (Util_Reas_Link table) linked to the existing entities are copied to the new entities.
- CanCaptureLabor: If the new entities are capable of capturing labor data, then all records from the Labor_Exec table linking the existing entities are copied to the new entities. Additionally, any default raw reasons (Labor_Raw_Reas table), labor reasons (Labor_Reas_Link table), and the labor departments that are restricted for an existing entity (Labor_Dept_Ent_Link table) from the existing entities are copied to the new entities.