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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Changing Things' Property Values From an If-Else Condition

rgomes
7-Bedrock

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!! 🙂

ACCEPTED SOLUTION

Accepted Solutions
dupatel
19-Tanzanite
(To:rgomes)

@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

View solution in original post

6 REPLIES 6
dupatel
19-Tanzanite
(To:rgomes)

@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
7-Bedrock
(To:dupatel)

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

rgomes
7-Bedrock
(To: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! Smiley Sad This is a very strange behavior!

dupatel
19-Tanzanite
(To:rgomes)

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

rgomes
7-Bedrock
(To:dupatel)

Hello, @dupatel!

 

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

 

Thanks!

dupatel
19-Tanzanite
(To:rgomes)

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

Announcements

Top Tags