QPR Knowledge Base 2012.1

CreateInstance

CreateInstance

Previous topic Next topic  

CreateInstance

Previous topic Next topic  

Revision history:

Introduced in QPR 8.0

 

Creates a new element instance and returns the FullId (String) = <Id>.<InstanceId> of the created instance.

 

Synopsis:

 

PGModel.CreateInstance(ElementId, Parameters, out FullId)

 

Parameters:

 

ElementId: Integer. Id of the element to be instantiated.

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

ProcessLevel=<PS level Id>: Defines the process level where the instance is created. If omitted, the instance is created under the main process level.

OrganizationUnit=<Organization Unit ID>: Defines the organization unit where the instance is created. Note that the organization unit must be instantiated to the process level that is defined with the ProcessLevel= parameter. Instance graphical properties are set automatically so that instance is placed inside the Organization unit lanes.

InstanceGraphicalProperties=<startpoint.X>,<startpoint.Y>,<height>,<width>: Defines the graphical position and size of the 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.

FullId (String) = <Id>.<InstanceID> of the created instance.

 

Required Rights:

 

Modify rights to the process level.

 

Return Values:

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

 

RV_SUCCESS

RV_MODEL_NOT_OPEN

RV_ELEMENT_NOT_FOUND

RV_CANNOT_CREATE_ELEMENT

RV_INVALID_PARAMETER

 

Example Procedure:

 

iResult = PGModel.CreateInstance(12345, "InstanceGraphicalProperties=1050,800,100,150;", FId)

'Creates a new instance of the element with Id 12345, sets the graphical properties for the instance. Returns the FullId of the new instance in the form "12345.<InstanceId>'