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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

A Simple Example on retrieving Persistent Data

No ratings

Persistent properties are stored in ThingWorx database while non-persistent properties are stored in memory. This means that the persistent values do not get erased or deleted if the thing restarts or platform restarts.

The persistent properties can also be retrieved in the same way as non-persistent properties.

To explain better how we can retrieve persistent data, please consider the below example:

I took a device group which has multiple devices and defined 2 persistent properties. One is serial number and the other is firmware version number. Now in a mashup builder, the user gives the serial number and the corresponding firmware version will be retrieved. I achieved this by writing services for that thing.

  1. Created a Data shape with the name DeviceData and defined two filed definitions. One is Serial number and the other is firmware version.
  2. Created a thing template with the name DevGroup.
    1. Added a property in the thing template with the name DeviceData and selected the basetype as info table. Also selected the previously created data shape (Device Data) in data shape field.
    2. And made this property as persistent data by selecting Is Persistent.
    3. Saved the property.
  3. Created two devices with the names Device1 and Device2. Both the devices use the above template. Now for each device set the property values by clicking the set button in properties link. These values will be persistent, meaning they do not change even after refresh or when you restart ThingWorx. You can even set these properties at run time by just creating a service.
  4. Created GetFirmversion service which retrieves the firm version of given service number.
  5. Created mashup as shown below:

.

Once you select Device1, enter the serial number in the numeric entry field and click query button, the firmware version of the given serial number is displayed along with the data of device1. If we enter a wrong number, no data will be displayed. You can also set an error message instead of displaying empty values.

Similar case when we select the device2 data.

This is one way to retrieve persistent data. You can also obtain the same in many ways.

Version history
Last update:
‎Jul 17, 2017 01:49 PM
Updated by:
Labels (1)
Tags (1)