QPR Knowledge Base 2017.1

CreateObject

CreateObject

Previous topic Next topic No directory for this topic  

CreateObject

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

Revision history:

Introduced in QPR 7.5.1

Last changed in QPR 2012

 

Creates a new object of the type defined in the function call to the model. Note that in the case the object does not have parameters that define its parent model element, you will need to attach the object to a model element separately using the AttachObject function. The following object types are supported:

INFORMATIONITEM (element type id -7)

ALERT (element type id -18). By default, the alert will be created with the "Value changed > Immediately when value changes" setting and the recipient is the user that has executed the CreateObject command.

LINKED ELEMENT (id of the linked element type)

 

Synopsis:

 

SCModel.CreateObject(ObjectType, Name, Parameters, out ObjectId)

 

Parameters:

 

ObjectType: String | Integer. Object type name (string) or id (integer). See the listing above for supported object types.

Name: Name of the object. String. Optional. If the name parameter is left empty, a default name is generated.

Parameters: String. A semicolon-separated list of parameters for object creation. The parameters available for different object types are listed below:

INFORMATIONITEM: no supported parameters. Use an empty string.

ALERT: parameters are defined as "Parameter Name=Value"

ELEMENTID: Integer. ID of the measure for which the alert is created. Mandatory parameter.

SERIES: Integer | String. ID of the series in the measure defined by ELEMENTID. This can be also a series identifier such as "ACT". Mandatory parameter.

LINKED ELEMENT:

OWNERID: ID of the measure for which the new linked data element is created. Mandatory parameter.

ObjectId: Variant. ID of the newly created object is returned in this parameter.

 

Required Rights:

 

Administrator or Model Administrator rights to the SCModel.

 

Return Values:

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

 

RV_APPLICATION_QUIT_CALLED

RV_NOT_CONNECTED_TO_SERVER

RV_NOT_AUTHENTICATED

RV_SUCCESS

RV_MODEL_NOT_OPEN

RV_NO_RIGHTS

RV_INVALID_OBJECT_TYPE

RV_INVALID_NAME

RV_INVALID_PARAMETER

RV_TOO_LONG_STRING

RV_UNKNOWN_ERROR

RV_CANNOT_SET_NAME

 

Example Procedure:

 

iResult = SCModel.CreateObject("INFORMATIONITEM","Link to QPR WEB page","",oId)

 

iResult = SCModel.CreateObject("ALERT","A1","ELEMENTID=162166380;SERIES=ACT",OId)