PropertyValue Type

When a reference to an object property is obtained it is possible to read its attributes as defined in the object model or in its instance itself. The property attributes can be retrieved using the attributes property of the PropertyValue data type. For further reference, see the following table.

 

Property

Type

Description

descriptor

String

Localized descriptor for the property.

error

Error

In case of error, it indicates the reason why the operation failed.

max

Object

Maximum value for the PropertyValue, if defined.

min

Object

Minimum value for the PropertyValue, if defined.

propertyName

String

Name of the property.

resolution

Integer

Data resolution for data types where resolution is available (such as, GmsReal).

type

String

Data type of the value.

unitDescriptor

Integer

Unit of measurement represented as localized string for those data types where unit is applicable (such as, GmsReal, GmsInt, GmsUint).

uintId

Integer

Numeric identifier of the unit of measurement for data types where unit is applicable.

value

Value

Value of the property. For further reference, see the following value table.

isScaled

Boolean

Flag indicating whether the property has a scaled unit, if applicable.

factor

Double

The scaling factor, if applicable.

offset

Double

The value offset, if applicable.

A read of property values is returned in the following cases:

  • Read of property values returned by the read method.
  • Read of property values returned by the subscribe method in case of value change and callback execution.

Value

The Value property type of the PropertyValue data type allows retrieving the values of the referenced system object property as defined in the object model or in the property itself. For further reference, see the following table.

 

Property

Type

Description

displayValue

String

Property value for display purpose (such as, display in the Operation tab). It display the value with unit and resolution (if applicable), and enumerated texts.

quality

QualityBits

Quality flags as returned when reading the property value.
NOTE: This property contains the value of dpVariant.OnlineStatus (Internal status bits: 00-23; user bits: 24-31). This property reflects IOWA _online.._status.

qualityGood

Boolean

Flag that indicates whether the device is reachable when the value of the property is read.
NOTE: If the device is not reachable, this property will have the value of data point dpVariant.IsDeviceFailed. The property IsDeviceFailed verifies that the DriverFailedBit is not raised in OnlineStatus. Additionally, it verifies the value that was set once (OnlineDefined).

timestamp

DateTime

The time when the value is read from the device. For more details, see Date- and Time-related Functions.
NOTE: This property contains the source time, such as the value of dpVariant.OnlineStamp converted to UTC format. This property reflects IOWA _online ._stime.

type

String

Data type for this value.

value

Object

Raw value. It can be of any type, including arrays.

If a scaled unit is specified for the property, the value is scaled according to the scaled unit.

When using the virtual objects it is possible to verify the differences between the supported properties. Any type of virtual object supports a different data type.

Examples of Use

 

How to print any property attributes after a read

var property = read("System1.ApplicationView:ApplicationView.Logics.Scripts.script", "Notes");

    printPropertyAttributes(property);

 

function printPropertyAttributes(property) {

    console(

        "Value: " + property.value.value +

        "\nDisplayValue: " + property.value.displayValue +

        "\nPropertyName: " + property.propertyName +

        "\nDescriptor: " + property.descriptor +

        "\nType: " + property.value.type +

        "\nMin: " + property.min +

        "\nMax: " + property.max +

        "\nUnitDescriptor: " + property.unitDescriptor +

        "\nResolution: " + property.resolution);

}

 

How to print any attributes for a property on which a callback is executed

subscribeValues("System1.ApplicationView:ApplicationView.Logics", "StatusPropagation.AggregatedSummaryStatus", function(object, values){

printPropertyAttributes(values["StatusPropagation.AggregatedSummaryStatus"]);

});

 

function printPropertyAttributes(property) {

    console(

        "Value: " + property.value.value +

        "\nDisplayValue: " + property.value.displayValue +

        "\nPropertyName: " + property.propertyName +

        "\nDescriptor: " + property.descriptor +

        "\nType: " + property.value.type +

        "\nMin: " + property.min +

        "\nMax: " + property.max +

        "\nUnitDescriptor: " + property.unitDescriptor +

        "\nResolution: " + property.resolution);

}

 

Note that values is a dictionary (key-values couples) that contains any system object properties that changed (keys) and their new value. Consequently, it is necessary to:

  • Choose the in the dictionary using dot notation or bracket notation. For example:
    values["StatusPropagation.AggregatedSummaryStatus"]
  • Access the property attributes.
    values["StatusPropagation.AggregatedSummaryStatus"].DisplayValue, values["StatusPropagation.AggregatedSummaryStatus"].Min

Anyway, it is also possible to access the value of the concerned property like in a standard callback. For example: values["StatusPropagation.AggregatedSummaryStatus"].Value