cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

SDK Reference Part 2

No ratings

 

 

Step 2: Java Properties

 

In the ThingWorx environment, a Property represents a data point, which has a:

 

  • Name
  • Value
  • Timestamp
  • Quality (optional)

 

Define Properties

 

You can define attributes, base types and other aspects of ThingWorx properties.

 

Attributes

 

The table below provides information on the different attributes that are used to define a property.

Attribute Details
name Specifies the name of the property that will appear in ThingWorx when users browse to bind the related Thing.
description Provides additional information for the property.
baseType Specifies the type of the property. For a list of base types supported by the SDK, refer to the BaseTypes chart below.

 

BaseTypes

 

The table below provides information on the different types of properties that can be created in ThingWorx.

BaseType Primitive Description
BOOLEAN BooleanPrimitive True or false values only
DATETIME DatetimePrimitive Date and time value
GROUPNAME StringPrimitive ThingWorx group name
HTML StringPrimitive HTML value
HYPERLINK StringPrimitve Hyperlink value
IMAGE ImagePrimitive Image value
IMAGELINK StringPrimitive Image link value
INFOTABLE InfoTablePrimitive ThingWorx infotable
INTEGER IntegerPrimitive 32–bit integer value
JSON JSONPrimitive JSON structure
LOCATION LocationPrimitive ThingWorx location structure
MASHUPNAME StringPrimitive ThingWorx Mashup name
MENUNAME StringPrimitive ThingWorx menu name
NOTHING N/A No type (used for services to define void result)
NUMBER NumberPrimitive Double precision value
STRING StringPrimitive String value
QUERY N/A ThingWorx query structure
TEXT StringPrimitive Text value
THINGNAME StringPrimitive ThingWorx Thing name
USERNAME StringPrimitive ThingWorx user name
XML XMLPrimitive XML structure

 

Aspects

 

Aspects define the ways to interact with a property. The table below provides information on frequently used Aspect attributes of a property.

Attribute Description
isPersistent Set to TRUE for the ThingWorx server to persist the value even if it restarts. It is extremely expensive to have persistent values, so it is recommended to set this value to FALSE unless absolutely necessary.
isReadOnly Set to TRUE to inform the ThingWorx server that this value is only readable and cannot be changed by a request from the server.
dataChangeType Describes how the ThingWorx server responds when the value changes in the client application. Subscriptions to these value changes can be modeled in ThingWorx Core. If nothing needs to react to the property change, set this value to NEVER.
dataChangeThreshold Defines how much the value must change to trigger a change event. For example 0 (zero) indicates that any change triggers an event. A value of 10 (ten) for example would not trigger an update unless the value changed by an amount greater than or equal to 10.
defaultValue The default value is the value that ThingWorx Core uses when the RemoteThing connected to the device first starts up and has not received an update from the device. The value is different based on the different value for each base type.
cacheTime The amount of time that ThingWorx Core caches the value before reading it again. A value of -1 informs the server that the client application always sends its value and the server should never go and get it. A value of 0 (zero) indicates that every time the server uses the value, it should go and get it from the client application. Any other positive value indicates that the server caches the value for that many seconds and then retrieves it from the client application only after that time expired.
pushType Informs ThingWorx Core how the client application pushes its values to the server.

 

NOTEcacheTime and dataChangeThreshold are for subscribed (bound) properties ONLY.

 

DataChangeType Values

 

This field acts as the default value for the data change type field of the property when it is added to the remote Thing. The possible dataChangeType values are below:

Value Description 
ALWAYS Always notify of the value change even if the new value is the same as the last reported value.
VALUE Only notify of a change when a newly reported value is different than its previous value.
ON For BOOLEAN types, notify only when the value is true.
OFF For BOOLEAN types only, notify when the value is false.
NEVER Ignore all changes to this value.

 

PushType Values

 

This aspect works in conjunction with cacheTime. The possible pushType values are below:

Value Description
ALWAYS Send updates even if the value has not changed. It is common to use a cacheTime setting of -1 in this case.
VALUE Send updates only when the value changes. It is common to use a cacheTime setting of -1 in this case.
NEVER Never send the value, which indicates that ThingWorx server only writes to this value.It is common to use a cacheTime setting of 0 or greater in this case.
DEADBAND Added to support KEPServer, this push type is an absolute deadband (no percentages). It provides a cumulative threshold, such that the Edge device should send an update if its current data point exceeds Threshold compared to the last value sent to ThingWorx Core. It follows existing threshold fields limits.

 

 

Click here to view Part 3 of this guide.

Version history
Last update:
‎Mar 07, 2023 08:21 AM
Updated by:
Labels (1)