Skip to main content
1-Visitor
May 29, 2017
Question

Property with basetype as Number does not store value zero

  • May 29, 2017
  • 1 reply
  • 1901 views

Hi,

I have a virtual thing, which has a property whose baseType is NUMBER. When I start the client and when virtual thing is connected, if the initial values are zero for this  property for certain period of time, these zero values are displayed as null rather than zero. Once the value has some value greater than zero, the property values are logged exactly. So the problem is unless the property with baseType as NUMBER has some values greater than zero, these values will not be logged. How can I overcome this? I need property values to be zero not null if its zero.


Thanks,

Azim

1 reply

5-Regular Member
May 29, 2017

Hi Azim,

is the behaviour same when you try to set the value to 0 as default? Are you observing this on the platform side or on the edge devices?

ahawaldar1-VisitorAuthor
1-Visitor
May 30, 2017

Hello Sushant Pandey​,

I have not set any property to have default value. This is observed on platform side in valuestream. When i execute queryPropertyHistory Service I see that unless the values for a property is one, all zero values are set to null(missing values).

Note: All these properties are feeded into platform through virtual thing. Below is the property definition

@ThingworxPropertyDefinitions(

  properties={

  @com.thingworx.metadata.annotations.ThingworxPropertyDefinition(name="acceleration", description="Bogie acceleration reading", baseType="NUMBER", aspects={"dataChangeType:ALWAYS", "dataChangeThreshold:0", "cacheTime:-1", "isPersistent:TRUE", "isReadOnly:TRUE","isLogged:TRUE", "pushType:VALUE"}),

  @com.thingworx.metadata.annotations.ThingworxPropertyDefinition(name="time", description="time during which readings were recorded", baseType="DATETIME", aspects={"dataChangeType:ALWAYS", "dataChangeThreshold:0", "cacheTime:-1", "isPersistent:TRUE", "isReadOnly:TRUE","isLogged:TRUE", "pushType:VALUE"}),

  @com.thingworx.metadata.annotations.ThingworxPropertyDefinition(name="start", description="indicates start point of readings", baseType="NUMBER", aspects={"dataChangeType:ALWAYS", "dataChangeThreshold:0", "cacheTime:-1", "isPersistent:TRUE", "isReadOnly:TRUE","isLogged:TRUE", "pushType:VALUE"}),

  @com.thingworx.metadata.annotations.ThingworxPropertyDefinition(name="end", description="indicates end point of readings", baseType="NUMBER", aspects={"dataChangeType:ALWAYS", "dataChangeThreshold:0", "cacheTime:-1", "isPersistent:TRUE", "isReadOnly:TRUE","isLogged:TRUE", "pushType:VALUE"})

  }

  )

5-Regular Member
May 30, 2017

@Azim could you please test by setting the property to 0 as default value, since you mentioned once the client is connected until the value changes the property value is 0.

A minor question: do you really wish to log values with property value being 0? Because as you have set that the values should always be pushed on value change and since it's 0 there is no change to push.