Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Application Server

SetCustomPropertyValue()

  • Last UpdatedFeb 07, 2024
  • 2 minute read

Change the expression or reference of a custom property at run time.

Category

Graphic Client

Syntax

SetCustomPropertyValue(System.String name, System.String value, System.Boolean isConstant);

Parameters

Name

The name of the custom property to be modified on the graphic. This is a string property and can be a reference or a constant.

Value

The new value to be set. Value is a string property and can be an expression, reference, or constant. If the value is given in quotes ("), then the value is considered a constant. If the value is given without quotes, then the value of the expression is considered a reference.

isConstant

IsConstant is a Boolean flag that indicates whether the new value will be evaluated as a constant or a reference.

  • If set to True (1), then the new value will be treated as a constant.

  • If it is set to False (0), then the new value will be treated as a reference.

    This parameter only applies when the value parameter is a reference or constant and the custom property specified in the name parameter is a string or time type. This parameter has no meaning if the custom property is an integer, float, Boolean, or double type.

    isConstant does not override the type of input for the value parameter. The value parameter itself can be either a constant or a reference, depending on whether it is enclosed in quotes. The isConstant parameter is only determines how the actual value (coming from the Value parameter) is evaluated.

Additional Information

The whole expression or reference of the custom property is replaced with the new value, regardless if it is overridden or not. No partial replacement is supported.

Only public custom properties on the graphic can be changed.

When the method executes, it overrides any modifications done by previous IOSetRemoteReference() calls from a native InTouch script.

Examples

Configuring the custom property as a reference:

Motor_001 is an object with the string attribute name "State" that stores the current state of the motor ("Running" or "Stopped"). You also have an Industrial graphic that has the string data type custom property "MotorState." The following script code will set the MotorState custom property to Motor_001.State in run-time:

GraphicA.SetCustomPropertyValue("MotorState","Motor_001.State",False);

As a result of the call, the function will set the string custom property GraphicA.MotorState to "Motor_001.State" as a reference. The string custom property GraphicA.MotorStatus will resolve that reference and update its value with the reference value ("Running" or "Stopped").

Configuring the custom property as a constant:

Motor_001 is an object with the Boolean attribute name "State" that reflects the current state of the motor (True or False). You also have an Industrial graphic that has the string data type custom property "MotorState." The following script code causes the MotorState custom property to hold the state of equipment—"Running" or "Stopped"—as text based on the value returned for Motor_001:

IF Motor_001.State THEN

GraphicA.SetCustomPropertyValue("MotorState","Running",True);

ELSE

GraphicA.SetCustomPropertyValue("MotorState","Stopped",True);

ENDIF;

As a result of the call, the function will set the string custom property GraphicA.MotorState to "Running" or "Stopped," depending on the value of Motor_001.State.

In This Topic
TitleResults for “How to create a CRG?”Also Available in