QPR Knowledge Base

CreateElement

Hide Navigation Pane

CreateElement

Previous topic Next topic No expanding text in this topic  

CreateElement

Previous topic Next topic JavaScript is required for expanding text Mail us feedback on this topic!  

Comments (...)

Revision history:

Introduced in QPR 8.0

Last changed in QPR 8.1 SP7

 

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

 

Synopsis:

 

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

 

Parameters:

 

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

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 element is created under root. Note that ParentElement can be set only for the element types that have the ParentElement attribute.
ProcessLevel=<PS level Id>: Defines the process level where the default first instance is created. If omitted, 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 process level 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.

 

Required Rights:

 

Modify rights to the process level.

 

Return Values:

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

 

RV_SUCCESS

RV_CANNOT_CREATE_ELEMENT

RV_INVALID_PARAMETER

RV_ELEMENT_IS_NOT_SUBPROCESS

RV_APPLICATION_QUIT_CALLED

RV_MODEL_NOT_OPEN

RV_ELEMENT_TYPE_NOT_FOUND

 

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 process level, 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 process level, places the element to the organization unit with ID 121212, and sets the height and width graphical properties for the instance.'

Comments (...)