Please enable JavaScript to view this site.

QPR Knowledge Base 2025.1

Navigation: Developer's Guide > QPR API > The Object Model > QPR Metrics > SCModel Commands

SetProperty

Scroll Prev Top Next More

Revision history:

Introduced in QPR 7.2.1

Last changed in QPR 2025.1

 

Set a value for an element's property. PropertyName is not case sensitive.

 

Synopsis:

 

SCModel.SetProperty(ObjectId, PropertyName, Value)

 

Parameters:

 

ObjectId: Integer. ID of period/value setting/alert/element, etc.

PropertyName: String. Name of some supported property.

Value: Variant (array). Value for the property. This can be array in the case PropertyName is ELEMENTSERIES and ObjectId refers to a measure. The following properties are supported depending on the element type:

ObjectId refers to a scorecard:

 NAME, String

 SYMBOL, String. Listed only for backward compatibility, please use IDENTIFIER instead.

 IDENTIFIER, String

 DESCRIPTION, String

 OWNER, Integer (user ID)  

 PARENTSCORECARDID, Integer

 BASESCORECARD, Integer

 INHERITANCEOPTIONS. A two-dimensional array with 2 columns. The rows are a freely selectable set of the following inheritance options in the first column (one option per row) with the second column containing a flag indicating whether the option should be enabled (1) or disabled (0):

name

description

elementtype

measureunit

roles

valuesettings

periodlevel

accumulationrule

viewsettings

seriessettings

values

scorecardstructure

scorecardstructure_noref

scorecardstructure_addonly

customattributes

 CUSTOMFIELD, String

 CUSTOMATTRIBUTE jsonpath=""<JSONPath>"", inheritfrom=""<inheritfrom>"", String. If the custom text field contains valid JSON that has a value at the given JSONPath, that value is replaced. If inheritfrom is: omitted, searches only the scorecard's own custom text field; PARENT, searches also the parent scorecard if no match found from the specified scorecard; PARENTHIERARCHY, searches also all ancestor scorecards, if no match found from the specified scorecard, starting from the immediate parent scorecard and moving up the hierarchy.

ObjectId refers to an element:

 NAME, String

 SYMBOL, String. Listed only for backward compatibility, please use IDENTIFIER instead.

 IDENTIFIER, String

 DESCRIPTION, String  

 PARENTELEMENTID, Integer

 MEASUREUNITID, Integer

 INCHARGE, Integer (user ID). Sets a user to the primary role defined for the element.

 ACCUMULATIONRULE, Integer:

Sum = 0

Average = 1

Min = 2

Max = 3

First = 4

Last = 5

Sum (ignore null) = 6

Average (ignore null) = 7

None = 8

Latest = 10

 VALUESETTINGID, Integer

 PERIODLEVELID, Integer

 ELEMENTSERIES. A two-dimensional array with 6 columns. One line is defined per ElementSeries and the array has the following columns (properties):

Series Id, Integer

ElementSeries Label, String. The series label defined in the Element Properties dialog.

ElementSeries UnitId, Integer

ElementSeries AccumulationRule, see the ACCUMULATIONRULE property description for reference about possible values

ElementSeries Inputtype. The possible values are 0 (Manual input), 1 (Formula), 2 (SQL), or 3 (ADO). Integer.

ElementSeries Formula (empty string if formula does not exist). String.        

 CHARTTEMPLATE (name of the template). String.

 CHARTTEMPLATEID (ID of the template). Integer.

ROLES. A two-dimensional array of roles defined for the measure. The array contains one line per role, and the first line is the primary role corresponding to "In charge" user in earlier versions of QPR ScoreCard. The array has the following columns:

id, Integer. ID of the role

name, String. Name of the role. Use an empty string here as the SetProperty function uses only ID-based matching.

userId, Integer. ID of the user assigned to the role.  

DRILLDOWNOPTIONS, a two-dimensional array with two columns. The rows are a freely selectable set of the following drill down options in the first column (one option per row) with the second column containing the value of a subproperty or a flag indicating whether the option should be enabled (1) or disabled (0):

enableautomaticreferencing, Boolean: true | 1 | false | 0.

drilldowndepth, Integer.

referencewithsymbol, Boolean: true | 1 | false | 0. Reference elements with matching Identifier.

referencewithname, Boolean: true | 1 | false | 0. Reference elements with matching Name.

removeunmatching, Boolean: true | 1 | false | 0. Removes unmatching reference elements.

 CUSTOMFIELD, String

 CUSTOMATTRIBUTE jsonpath=""<JSONPath>"", inheritfrom=""<inheritfrom>"", String. If the custom text field contains valid JSON that has a value at the given JSONPath, that value is replaced. If inheritfrom is: omitted, searches only the element's own custom text field; PARENT, searches also the parent element if no match found from the specified element; PARENTHIERARCHY, searches also all ancestor elements, if no match found from the specified element, starting from the immediate parent element and moving up the hierarchy; SCORECARD, searches also the scorecard if no match found from the element; SCORECARDHIERARCHY, searches also the scorecard and all ancestor scorecards, moving up the scorecard hierarchy; COMBINEDHIERARCHY, proceeds first according to PARENTHIERARCHY and then according to SCORECARDHIERARCHY; ELEMENTYPE; VALUESETTING; PERIODLEVEL; GRAPHLAYOUTTEMPLATE; MEASUREUNIT, searches also the element's element type, value setting, period level, graph layout template or measure unit if no match found from the element.

ObjectId refers to a period level:

 NAME, String

 SYMBOL, String. Listed only for backward compatibility, please use IDENTIFIER instead.

 IDENTIFIER, String

 DESCRIPTION, String  

 PERIODLEVELPREFIX, String

 PERIODLEVELTYPE, Integer:

Year = 100

Half year = 200

Third = 300

Quarter = 400

Month = 500

Week = 600

Day = 700

Custom = 800

 PERIODLEVELACCUMULATION, Integer:

First day of period = 0

Last day of period = 1

Middle of period = 2

LOCKDATEOFFSET, Integer. Offset in days for automatic locking after the end of period.

ISLOCKDATEOFFSETENABLED, Boolean. The automatic locking offset enabled/disabled status. Note that this can only be set to false. Setting this to true is done by setting a value to SP_LOCKDATEOFFSET.

 CUSTOMFIELD, String

 CUSTOMATTRIBUTE jsonpath=""<JSONPath>"" , String. If the custom text field contains valid JSON that has a value at the given JSONPath, that value is replaced.

ObjectId refers to a period:

LOCKED, Boolean. The locked/unlocked status of the period.

 CUSTOMFIELD, String

 CUSTOMATTRIBUTE jsonpath=""<JSONPath>"", inheritfrom=""<inheritfrom>"", String. If the custom text field contains valid JSON that has a value at the given JSONPath, that value is replaced. If inheritfrom is: omitted, searches only the period's own custom text field; PARENT, searches also the period level if no match found from the period.

ObjectId refers to a range:

 NAME, String

 SYMBOL, String. Listed only for backward compatibility, please use IDENTIFIER instead.

 IDENTIFIER, String

 DESCRIPTION, String  

 RANGEVALUE, Integer

 CUSTOMFIELD, String

 CUSTOMATTRIBUTE jsonpath=""<JSONPath>"", inheritfrom=""<inheritfrom>"", String. If the custom text field contains valid JSON that has a value at the given JSONPath, that value is replaced. If inheritfrom is: omitted, searches only the range's own custom text field; PARENT, searches also the value setting if no match found from the range.

ObjectId refers to a history chart template:

 NAME, String

 SYMBOL, String. Listed only for backward compatibility, please use IDENTIFIER instead.

 IDENTIFIER, String

 DESCRIPTION, String

 AUTHOR, Integer (user ID)

 CUSTOMFIELD, String

 CUSTOMATTRIBUTE jsonpath=""<JSONPath>"" , String. If the custom text field contains valid JSON that has a value at the given JSONPath, that value is replaced.

ObjectId refers to a series:

NAME, String

SYMBOL, String. Listed only for backward compatibility, please use IDENTIFIER instead.

IDENTIFIER, String

DESCRIPTION, String

REVERSEDTREND, Boolean (0 = false, 1 = true)

TRENDTYPE Integer (0 = two period difference, 1 = one period polarity).

DEFAULTFORMULA, String

CUSTOMFIELD, String

CUSTOMATTRIBUTE jsonpath=""<JSONPath>"", inheritfrom=""<inheritfrom>"", String. If the custom text field contains valid JSON that has a value at the given JSONPath, that value is replaced. If inheritfrom is: omitted, searches only the custom text field of the series; PARENT, searches also the value setting if no match found from the series.

ObjectId refers to a value setting:

 NAME, String

 SYMBOL, String. Listed only for backward compatibility, please use IDENTIFIER instead.

 IDENTIFIER, String

 DESCRIPTION, String  

 DEFAULTSERIESID, Integer

 FORCEMIN, Boolean (0 = false, 1 = true)

 FORCEMAX, Boolean (0 = false, 1 = true)

 CUSTOMFIELD, String

 CUSTOMATTRIBUTE jsonpath=""<JSONPath>"" , String. If the custom text field contains valid JSON that has a value at the given JSONPath, that value is replaced.

ObjectId refers to a information item:

 NAME, String

 SYMBOL, String. Listed only for backward compatibility, please use IDENTIFIER instead.

 IDENTIFIER, String

 DESCRIPTION, String

 LOCATION, String

 CUSTOMFIELD, String

 CUSTOMATTRIBUTE jsonpath=""<JSONPath>"" , String. If the custom text field contains valid JSON that has a value at the given JSONPath, that value is replaced.

ObjectId refers to a measure unit:

 NAME, String

 SYMBOL, String. Listed only for backward compatibility, please use IDENTIFIER instead.

 IDENTIFIER, String

 DESCRIPTION, String  

 UNITSYMBOL, String

 NUMBEROFDECIMALS, Integer

 DECIMALSEPARATOR, String

 DIGITSINGROUP, Integer

 DIGITSEPARATOR, String

 UNITBEFOREVALUE, Boolean (0 = false, 1 = true)

 CUSTOMFIELD, String

 CUSTOMATTRIBUTE jsonpath=""<JSONPath>"" , String. If the custom text field contains valid JSON that has a value at the given JSONPath, that value is replaced.

ObjectId refers to an alert:

 ALERTTYPE, Integer:

Value changed = 0

Value in range = 1

Value missing = 2

 ALERTRANGEID, Integer

 DELAYED, Boolean (0 = false, 1 = true)

 ALERTDELAY, Integer

 ALERTURL, String

 RECIPIENTS. One-dimensional array of user and group IDs. All IDs must be valid and have access to the model and element.

ObjectId refers to a linked element:

NAME, String

SYMBOL, String. Listed only for backward compatibility, please use IDENTIFIER instead.

IDENTIFIER, String

DESCRIPTION, String

AUTHOR, Integer

STATUS, Integer (0 = Draft, 1 = Proposal, 2 = Obsolete, 3 = Accepted)

CUSTOMFIELD, String

CUSTOMATTRIBUTE jsonpath=""<JSONPath>"" , String. If the custom text field contains valid JSON that has a value at the given JSONPath, that value is replaced.

ObjectId refers to an element type:

NAME, String

SYMBOL, String. Listed only for backward compatibility, please use IDENTIFIER instead.

IDENTIFIER, String

DESCRIPTION, String

ROLES. A two-dimensional array of roles defined for the element type. The array contains one line per role, and the first line is the primary role corresponding to "In charge" user in earlier versions of QPR ScoreCard. The array has the following columns:

id, Integer. ID of the role

name, String. Name of the role.

description, String. Description of the role.

CUSTOMFIELD, String

CUSTOMATTRIBUTE jsonpath=""<JSONPath>"" , String. If the custom text field contains valid JSON that has a value at the given JSONPath, that value is replaced.

 

Note: In the case the ObjectId points to a reference element, any property not visible for reference elements is set to the original element instead. Reference elements can have the following properties: order, level, index, parentelementid, referenceid, sourcemodelid, sourceobjectid, and scorecardid.

 

Required Rights:

 

At least update rights to the object. BASESCORECARD and INHERITANCEOPTIONS properties require administrator or model administrator rights. CUSTOMATTRIBUTE, when used with the inheritfrom parameter, requires view rights to all objects that need to be traversed until a matching JSONPath is found, and update rights to the object, whose custom text field is to be modified.

 

Return Values:

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

 

RV_SUCCESS

RV_MODEL_NOT_OPEN

RV_APPLICATION_QUIT_CALLED

RV_NOT_CONNECTED_TO_SERVER

RV_NOT_AUTHENTICATED

RV_NO_RIGHTS

RV_ELEMENT_NOT_FOUND

RV_PROPERTY_NOT_SUPPORTED

RV_PROPERTY_CANNOT_BE_UPDATED

RV_TOO_LONG_STRING

RV_INVALID_PARAMETER

RV_OBJECT_IS_LOCKED

RV_SCORECARD_NOT_FOUND

RV_UNKNOWN_ERROR

RV_INVALID_USERID

 

Example Procedure:

 

iRet = SCModel.SetProperty(ObjectId, "Name", "New Name")