2 Replies Latest reply on Jul 6, 2017 2:54 AM by carlesc RSS
    ketanm Explorer

    How to fetch BaseType information of property runtime?

    I have a property for a Thing "WeatherRover" which has a property "Speed". While creating "Speed" property, i mentioned following BaseType info,

     

    Base Type: Number

    Units: km/hr

    Min Value: 0

    Max Value: 20

     

    Now I want to use this Base Type info on the mashup i.e. Units, Min Value and Max Value. How to get this BaseType information provided for each property? I tried using "GetPropertyDefinition" Service, but it doesn't gives all the info needed.

     

    1_Property_Details.png

     

    2_Mashup_Service.png

    I also tried with other services like GetPropertyDefinitions, GetPropertyValues, GetPropertyLogging but none of them giving me the information I am looking for. Any help around it would be appreciated.

     

    Thanks,

    Ketan

      • Re: How to fetch BaseType information of property runtime?
        carko Creator

        Hello, Ketan.

         

        What results to you get returned from 'GetPropertyValues?' That would normally be my first thought here.

         

         

        -- Craig A.

        • Re: How to fetch BaseType information of property runtime?
          carlesc Heavyweight Champ

          Hi Ketan,

           

          There's no Out-Of-The-Box service to recover Units, Min and Max Values. You will have to build you own service which internally recovers it and builds an Infotable with the desired metadata.

           

          Here you have a sample code to recover thouse Property aspectects:

           

          var values = me.GetNamedProperties({ propertyNames: { "items": [ "myPropertyName"] } } );

           

          var fieldAspects = values.dataShape.fields["myPropertyName"].aspects;

           

          // -- List of available aspects:

          fieldAspects.thingShape

          fieldAspects.thingTemplate

          fieldAspects.isReadOnly

          fieldAspects.isPersistent

          fieldAspects.isLogged

          fieldAspects.units

          fieldAspects.dataChangeType

          fieldAspects.dataChangeThreshold

          fieldAspects.defaultValue

          fieldAspects.minimumValue

          fieldAspects.maximumValue

          fieldAspects.dataShape

          values.dataShape.fields["myPropertyName"].category

          values.dataShape.fields["myPropertyName"].description


          Hope It helps.