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
Hello, everyone!
This question is quite simple:
From an AR experience (Vuforia), I want to change a Thing property (in Thingworx) only if a condition is attended. The problem is I have no idea about how the syntax is.
For example:
In Vuforia Studio > Home.js:
if(waterTemperature == 50)
{
...
[change a thing property from false to true];
...
}
I assume it would be something like "$scope.thing[ThingName].propertyvalue = true", right?
Thanks!! 🙂
Solved! Go to Solution.
@rgomes You a Car1 thing example having property CarOn you can use the JS code as -
$scope.app.mdl['Car1'].properties['CarOn'] == "Some Value or logic"
Please refer to attachment. Also as an easy way to get required detail, you can bind the ThingWorx entity using external data in Studio to an input text of widget then refer to Binding Expression for details.
-Durgesh
@rgomes You a Car1 thing example having property CarOn you can use the JS code as -
$scope.app.mdl['Car1'].properties['CarOn'] == "Some Value or logic"
Please refer to attachment. Also as an easy way to get required detail, you can bind the ThingWorx entity using external data in Studio to an input text of widget then refer to Binding Expression for details.
-Durgesh
Wow, how haven't I seen it on the binding details as you've shown?? I'm still a newbie, after all!
Thanks, @dupatel!!
Hello again, @dupatel !
Just an observation: the value is being updated on a 3D label bound to the Thing property (it's a Boolean property, so the label shows 'true' or 'false' only), but I've just noticed the value isn't being updated on Thingworx itself! This is a very strange behavior!
@rgomes Please review on what conditions the value should be updating in ThingWorx. Also, check if there is any error or message related to the property in discussion withing ThingWorx application, script logs.
Hello, @dupatel!
Nothing appears in the logs... Since it's another issue, I'll open another discussion if necessary 🙂
Thanks!
@rgomes Yes, that will actually be great for tracking different issue separately. Thanks !