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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Property with basetype as Number does not store value zero

ahawaldar
1-Visitor

Property with basetype as Number does not store value zero

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

4 REPLIES 4
supandey
19-Tanzanite
(To:ahawaldar)

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?

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"})

  }

  )

supandey
19-Tanzanite
(To:ahawaldar)

@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.

Sushant Pandey​,

I think I did not clarified you in a proper way. The values from virtual things properties are either zero or one. If the virtual thing sends zero values initially, in platform these values i.e. zero values are not stored in respective Things value stream. Once the virtual thing sends one values , the one values are stored in respective Things value stream. However after one values if there are any zero values again into the platform these values are stored in respective Things value stream. Zero values are missing only for initial readings till the values become one.


I tried setting default value but didnt helped.


Thanks,

Azim

Announcements


Top Tags