Please enable JavaScript to view this site.

QPR Knowledge Base 2019.1

Navigation: Developer's Guide > QPR API > The Object Model > QPR Modeling > PGModel Commands

CreateCopy

Scroll Prev Top Next More

Revision history:

Introduced in QPR 8.0

Last changed in QPR 2012.2

 

Creates a copy of an object referred to by FullId. Copies can be created from elements and element instances. If FullId refers to an element, a copy of the element is created with one default instance (one in parent process step). If FullId refers to an element's instance, a copy of the instance is created for the element.

 

Synopsis:

 

PGModel.CreateCopy(FullId, Name, Parameters, out FullId)

 

Parameters:

 

FullId: String. FullId of the element or element instance to be copied. Mandatory. No Default value. Note that if this value points at an element, a copy is created, but when this value points at an instance, a new instance is created.

Name: String. Name of the element.

Parameters: A semicolon-separated list of parameters for creating a new element. The supported parameters:

ParentElement=<ParentId>: Defines the parent in element hierarchy. If omitted, the new element gets the same parent element as the original one. Note that ParentElement can be set only for the element types that have the ParentElement attribute.

ProcessLevel=<PS level Id>: Defines the diagram where the default first instance is created. If omitted, the new element gets the same diagram as the original one.

OrganizationUnit=<Organization Unit Id>: Defines the organization unit where the default first instance is created. Note that the organization unit must be instantiated to the diagram that is defined with the ProcessLevel= parameter. Instance graphical properties are set automatically so that the instance is placed inside the organization unit lanes. If omitted, the new element gets the same organization as the original one.

InstanceGraphicalProperties=<startpoint.X>,<startpoint.Y>,<height>,<width>: Defines the graphical position and size of the first default instance. Some of the properties can be separately left empty. However, both <startpoint.X> and <startpoint.Y> must be set if position is needed to be set. If <startpoint.X> and <startpoint.Y> are set, these override the possible automatic Organization unit placement. If omitted, the new element gets the same graphical properties as the original one.

FullId: String. Id of the created element or instance. The returned value is in the <object ID>.<instance ID> format.

 

Required Rights:

 

Modify rights to the diagram.

 

Return Values:

Below are listed the return values that this function can return:

 

RV_SUCCESS

RV_INVALID_PARAMETER

RV_ELEMENT_NOT_FOUND

RV_ELEMENT_IS_NOT_SUBPROCESS

RV_APPLICATION_QUIT_CALLED

RV_MODEL_NOT_OPEN

RV_CANNOT_CREATE_ELEMENT

RV_FUNCTION_CANNOT_BE_USED_IN_VALIDATION_SCRIPT

 

Example Procedure:

 

iResult = PGModel.CreateCopy(PG.1234.5678.9, "Copy of Test Store", "InstanceGraphicalProperties=50,50,100,50;ProcessLevel=" +CStr(iSubprocessId), iStoreCopyId)