Property Transforms > Defining Property Transforms Programmatically
  
Defining Property Transforms Programmatically
Property transforms can be created quickly and easily through the Composer UI. However, property transforms can also be defined programmatically by calling the AddPropertyTransformDefinition service. This service can be called via any way that ThingWorx allows you to invoke services, such as ThingWorx REST APIs .
The key to configuring property transforms programmatically, is providing valid entries for the fieldName and fieldValue parameters in the propertyTransformConfig infotable required as input for the AddPropertyTransformDefinition service. The values you provide in the infotable depend on which type of property transformation you want to configure. You can find a list of the available transformations in Property Transforms.
The charts in the sections below list the valid fieldName and fieldValue parameters for the propertyTransformConfig infotable. The set of required parameters and valid values differs by transformation type.
Statistical Calculation Transformations
Statistical transformations include Maximum, Mean, Median, Minimum, Mode, Standard Deviation, and Range. Each of these transformation types requires the fieldName and fieldValue parameters listed in the chart below.
fieldName
fieldValue
sourceName
The name of the source property. This parameter is case sensitive.
dataCollectionValue
A number representing either the count of datapoints per collection window or the time span of the collection window in milliseconds.
transform
The type of transformation. Valid values: maximum, mean, median, minimum, mode, standarddeviation, range.
dataCollectionMethod
The type of collection window. Valid values: count, time
executionInterval
A number representing either the count of datapoints between calculations or the time span between calculations in milliseconds.
Statistical Monitoring Transformations
Statistical monitoring transformations include Threshold Count, Range Count, and Trend Count. The required fieldName parameters vary by transformation type and the valid fieldValue entries also depend on the transformation type. The chart below shows which fieldName parameters are necessary for each transformation type and what the valid values are for each.
Required For
fieldName
fieldValue
Threshold Count
Range Count
Trend Count
sourceName
The name of the source property. This parameter is case sensitive.
Yes
Yes
Yes
dataCollectionValue
A number representing either the count of datapoints per collection window or the time span of the collection window in milliseconds.
Yes
Yes
Yes
transform
The type of transformation. Valid values: threshold_count, range_count, trend_count.
Yes
Yes
Yes
thresholdType
Further defines the type of transformation count. Valid values depend on the fieldValue you entered for the transform fieldName:
threshold_count – threshold-above, threshold-below
range_count – range-in-range, range-out-of-range
trend_count – trend-increasing, trend-decreasing, trend-alternating
Yes
Yes
Yes
consecutivePoints
Indicates whether the count should include only consecutive points. Valid values: true, false
Yes
Yes
No
thresholdValue
A number representing the threshold.
Yes
No
No
thresholdValueInclude
Indicates whether the thresholdValue should be inclusive of the threshold. Valid values: true, false
Yes
No
No
thresholdMinValue
A number representing the lower threshold of the range. Must be less than the thresholdMaxValue.
No
Yes
No
thresholdMaxValue
A number representing the upper threshold of the range. Must be greater than the thresholdMinValue.
No
Yes
No
thresholdMinValueInclude
Indicates whether the thresholdMinValue should be inclusive of the lower threshold. Valid values: true, false
No
Yes
No
thresholdMaxValueInclude
Indicates whether the thresholdMaxValue should be inclusive of the upper threshold. Valid values: true, false
No
Yes
No