Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
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.
Solved! Go to Solution.
I believe this should get you going with the pattern to access the aspects Iterating Through a Thing's Properties
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
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.
I believe this should get you going with the pattern to access the aspects Iterating Through a Thing's Properties
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.
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
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;
}