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

Changing Things' Property Values From an If-Else Condition

SOLVED
Highlighted
Regular Member

Changing Things' Property Values From an If-Else Condition

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!! Smiley Happy

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Changing Things' Property Values From an If-Else Condition

@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

6 REPLIES 6

Re: Changing Things' Property Values From an If-Else Condition

@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

Re: Changing Things' Property Values From an If-Else Condition

Wow, how haven't I seen it on the binding details as you've shown?? Smiley Indifferent I'm still a newbie, after all!

 

Thanks, @dupatel!!

Re: Changing Things' Property Values From an If-Else Condition

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! Smiley Sad This is a very strange behavior!

Re: Changing Things' Property Values From an If-Else Condition

@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.

Re: Changing Things' Property Values From an If-Else Condition

Hello, @dupatel!

 

Nothing appears in the logs... Since it's another issue, I'll open another discussion if necessary Smiley Happy

 

Thanks!

Re: Changing Things' Property Values From an If-Else Condition

@rgomes  Yes, that will actually be great for tracking different issue separately. Thanks !