QPR Knowledge Base 2017.1

ExecuteProcedure

ExecuteProcedure

Previous topic Next topic No directory for this topic  

ExecuteProcedure

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

Revision history:

Introduced in QPR 2014.1

 

Performs a procedure in the model.

 

Synopsis:

 

PGModel.ExecuteProcedure(Procedure, Parameters, out Result)

 

Parameters:

 

Procedure: String. Defines the procedure to be executed. Currently supported procedures:

ReplaceWith: replaces an element with another element.

Parameters: String. A semicolon-separated list of parameters for the procedure.

Supported parameters for the ReplaceWith procedure:

oOriginalElement=<ElementId>[.<Instance>] | <ElementSymbol>[.<InstanceId>]: Defines the element and instance that will be replaced - a process step, store, organization item, or a custom element. If InstanceId has been defined, only that instance will be replaced. If InstanceId is not given, all instances of the element will be replaced. Diagram elements cannot be replaced.

oReplacingElement=<ElementId> | <ElementSymbol>: Defines the element that is used to replace the original element. This element cannot be a diagram element.

oDeleteOriginalElement=True | False | 1 | 0: Defines if the original element will be deleted after the replace has been done. The default value is False. If DeleteOriginalElement is True, the InstanceId cannot be given in the OriginalElementId parameter. If the element cannot exist without instances and all instances are replaced, the original element will be deleted regardless of the value of the DeleteOriginalElement parameter. If the element cannot be created on diagram, the original element will be deleted regardless of the value of the DeleteOriginalElement parameter.

out Result: Variant. Either success or error. Not used with the "ReplaceWith" procedure.

 

Required Rights:

 

Modify rights to the all diagrams where the element instances are replaced, and at least view rights to the element that will be used as the replacement element.

 

Return Values:

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

 

RV_SUCCESS

RV_INVALID_PARAMETER

RV_APPLICATION_QUIT_CALLED

RV_ACCESS_DENIED

RV_MODEL_NOT_OPEN

RV_FUNCTION_CANNOT_BE_USED_IN_VALIDATION_SCRIPT

RV_ELEMENT_NOT_FOUND

RV_INSTANCE_NOT_FOUND

RV_CANNOT_REPLACE_ELEMENT

RV_CANNOT_REPLACE_ELEMENT_WITH_DIFFERENT_TYPE

RV_CANNOT_REPLACE_SUBPROCESS

RV_CANNOT_REPLACE_WITH_SUBPROCESS

RV_CANNOT_DELETE_BASE_MODEL_ELEMENT

 

Example Procedure:

 

iResult = PGModel.ExecuteProcedure("replacewith", "ORIGINALELEMENT=CHILD1;REPLACINGELEMENT=BASE1;DELETEORIGINALELEMENT=true", oResult)