QPR Knowledge Base 2017.1



Previous topic Next topic No directory for this topic  


Previous topic Next topic Topic directory requires JavaScript Mail us feedback on this topic!  

Revision history:

Introduced in QPR 8.0

Last changed in QPR 2016.1


Creates a new model element and returns the Id of the element.




PGModel.CreateElement(TypeId | TypeName, Name, Parameters, out Id)




TypeId | TypeName: Element type Id (Integer) or Element type name (String) to be created. Mandatory. No Default value. The following values should be used for creating the system types:

Note type: Create a note

Checkpoint type: Create a checkpoint

Text type: Create a text item

Organization item type: Create an organization item

Store type: Create a store

Group type: Create a group

Information item type: Create an information item

Resource type: Create a resource

Picture type: Create a picture

Name: String. Name of the element. Not applicable for picture elements.

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 element is created under root. Note that ParentElement can be set only for the element types that have the ParentElement attribute.

PictureFileName=<Path to the picture file>: Defines the path to the image to use with the picture element.

ProcessLevel=<PS level Id>: Defines the process level where the default first instance is created. If omitted and the element can exist without instance, the element is created without instance. If omitted and the element can't exist without instance, the element is created under the main process level.

OrganizationUnit=<Organization Unit Id>: Defines the organization unit where the 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.

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 the possible automatic Organization unit placement. When creating an Organization Unit and the modeling direction is vertical, the <startpoint.X> and <width> parameters can be used, and when the modeling direction is horizontal, the <startpoint.Y> and <height> parameters can be used.

OptimizeRoute: True | False. Defines whether route optimization is used when drawing a flow. The default value is true. Optional

Id: Integer. Id of the created element.

From=<Id | FullId>: Defines the starting element id (Id) or instance id (FullId) for a created flow. If simple Id is given, the first instance is assumed. Optional.

To = <Id | FullId>: Defines the target element id (Id) or instance id (FullId) for a created flow. If simple Id is given, the first instance is assumed. Optional.

CustomHierarchy=<Hierarchy symbol>: The custom hierarchy where the element is to be created. If CustomHierarchy is not set and the element type has a default custom hierarchy, element is added to the default custom hierarchy. If CustomHierarchy is not set, and the element type doesn't have a default custom hierarchy, and the element is a system element with a system hierarchy, the element is added to the system hierarchy. Optional.


Note: When creating an element with the "Information container" behavior enabled, the user must manually select an information item for the element, as selecting the information item is not supported in the CreateElement function. In addition, if QPR Modeling Client is in silent mode, the element creation fails as the information item will not be selected.


Required Rights:


Modify rights to the diagram.


Return Values:

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












Example Procedure:


iResult = PGModel.CreateElement("Activity", "My Activity", "InstanceGraphicalProperties=1050,800,100,150;", EId)

'Creates an "Activity" type element named "My Activity" to the main diagram, and sets the graphical properties for the default instance'


iResult = PGModel.CreateElement("Subprocess",  "My Subprocess", "OrganizationUnit=121212; InstanceGraphicalProperties=,,100,150;", EId)

'Creates a "Subprocess" type element named "My Subprocess" to the main diagram, places the element to the organization unit with ID 121212, and sets the height and width graphical properties for the instance.'