2 Replies Latest reply on Jan 13, 2018 11:15 PM by nadams RSS
    nadams Explorer

    Dynamically change the Data Change Type

    I have a situation where I ordinarily only want to log a data change when there is a change greater than a particular value. But I have a requirement that I capture data more frequently and accurately when triggered into that mode. Is it possible to change the Data Change Type / Threshold via a service from the platform? can it be done on the edge?

      • Re: Dynamically change the Data Change Type
        nkhose Creator

        If you have a subcription on any property Datachange Event this can be done to log the data change on that specific property  , you can get the new

        data for that property as var newValue = eventData.newValue;

        Old value as var oldValue = eventData.oldValue;

        you can check something like

        if (newValue > someVal)


        // log the values here you can call any service Things['logdata'].Triggerlog()


        If you have not and subcription on property Add Subcription on that property and select event as DataChange

        Hope this helps

        • Re: Dynamically change the Data Change Type
          supandey Ninja

          Hi, just extending on what Nilesh mentioned you can also do this from the Edge device for this you will need to address the Aspect for that property, e.g.


          //Create the property definition with name, description, and baseType
          PropertyDefinition property1 = new PropertyDefinition(
            "Description for Property1",

          //Create an aspect collection to hold all of the different aspects
          AspectCollection aspects = new AspectCollection();

          //Add the dataChangeType aspect
          new StringPrimitive(DataChangeType.NEVER.name()));

          //Add the dataChangeThreshold aspect
          aspects.put(Aspects.ASPECT_DATACHANGETHRESHOLD, new NumberPrimitive(0.0));

          //Set the aspects of the property definition

          //Add the property definition to the VirtualThing


          For more have a look at the Edge Help Center > Aspects of Properties