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

How to get dataChangeThreshold property of a remote thing?

SOLVED
Highlighted
Level 5

How to get dataChangeThreshold property of a remote thing?

Hi there, I'm desperately trying to find a service which determines dataChangeThreshold value of a remote thing. I'd be grateful for your help!

GetPropertyDefinition() service output is limited.

There are some datashapes which have necessary fields, but I don't know what service is using any of them.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to get dataChangeThreshold property of a remote thing?

I believe this should get you going with the pattern to access the aspects Iterating Through a Thing's Properties

6 REPLIES 6

Re: How to get dataChangeThreshold property of a remote thing?

Hi Mnudel, since these values are part of Thing's Aspects have you tried Class Aspects and Class AspectCollection that should return array of collection. Plus this enum DataChangeType

Not sure if this helps

Re: How to get dataChangeThreshold property of a remote thing?

Sushant Pandey​, thank you for your response! I'm not familiar with Thing Aspects; is there a tutorial on this matter or a sample code I could use perhaps? Many thanks.

Re: How to get dataChangeThreshold property of a remote thing?

I believe this should get you going with the pattern to access the aspects Iterating Through a Thing's Properties

Re: How to get dataChangeThreshold property of a remote thing?

Sushant Pandey​​​, I deduced that the outputs of the services like GetPropertyDefinitions() and GetPropertyValues() have fields with associated 'aspects' objects. The former has the 'aspects' field as an output. I can solve my problem, however, it seems quite burdensome calling a service which gets a list of all properties beforehand. Is there a different, more direct way of extracting 'aspects' for a particular property?

How one could experiment with java classes and methods in ThingWorx? So far I was bound to JavaScript only. Thank you.

Re: How to get dataChangeThreshold property of a remote thing?

mnudel​ sorry I'm not aware of any other options at the moment. May be someone here has more idea on this.

I usually experiment the other way i.e. setting up Extension SDK and then building stuff together and then import that extension in ThingWorx. I'm not sure how much this would of help, but you can may be try something like what's discussed here javascript - Calling Java function from Rhino - Stack Overflow

Re: How to get dataChangeThreshold property of a remote thing?

Here is the best solution I could come up with


var propertyName = "someProperty";

try {

     var itemsJson = { "items": [propertyName] }

     var prop = Things["someThing"].GetNamedProperties( {propertyNames: itemsJson} );

     var fields = prop.dataShape.fields;  

    if (prop.rows.length > 0) {

        var result = fields[propertyName].aspects.dataChangeThreshold;

    } else {

        var result = 0;

    }

} catch(err) {

     var result = 0;

}