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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Indicate Boolean in AR experience

AramN
4-Participant

Indicate Boolean in AR experience

Hello!

 

Is there a way to indicate the boolean value in AR experience with the external data.

For example, if I have a led like indicator and I need to turn the led color to red if the value 1 is received from industrial connectivity (OPC-UA).

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @AramN,

I think there are more then one way to do this but the simples way is to use a filter.

 

You can bind the result of service or the thingworx thing propperty value to a widget property and then via filter ,  you can check the value and depenging of it you can change the property of the widget. Here example of modelitem widget which is bind of the property  CarOn of the Car1 Thing2019-04-11_14-42-10.gif

 

So now when we change the value of the property -> the modeitem will change the color:

 

2019-04-11_14-48-27.gif

So here in the filter I tested the property if true or false but you can use any check

if(value==0) return "rgba(255,33,112);";
else return "rgba(0,0,0);";
//or 
if(value <1) return "rgba(255,33,112);";
else
if( value < 2) return "rgba(0,255,0);";
else  
if( value < 3) return "rgba(0,0,255);";
else return  "rgba(0,0,0);";
//I did not check if switch syntax will work here  but I think it is javascript so 
//feel you free to try

 you can use the binding with a filter also to change the property of any widgets - e.g. 2d image widget where you can change the source property (you will here change the  image what is currently displayed) in the filter based on condition of you method. In this case the picture file should be already uploaded to the upload folder

2019-04-11_16-07-54.gifAnd for the 2d image widget the filter definition is some thing like this:

2019-04-11_16-12-00.gif

 

View solution in original post

1 REPLY 1

Hi @AramN,

I think there are more then one way to do this but the simples way is to use a filter.

 

You can bind the result of service or the thingworx thing propperty value to a widget property and then via filter ,  you can check the value and depenging of it you can change the property of the widget. Here example of modelitem widget which is bind of the property  CarOn of the Car1 Thing2019-04-11_14-42-10.gif

 

So now when we change the value of the property -> the modeitem will change the color:

 

2019-04-11_14-48-27.gif

So here in the filter I tested the property if true or false but you can use any check

if(value==0) return "rgba(255,33,112);";
else return "rgba(0,0,0);";
//or 
if(value <1) return "rgba(255,33,112);";
else
if( value < 2) return "rgba(0,255,0);";
else  
if( value < 3) return "rgba(0,0,255);";
else return  "rgba(0,0,0);";
//I did not check if switch syntax will work here  but I think it is javascript so 
//feel you free to try

 you can use the binding with a filter also to change the property of any widgets - e.g. 2d image widget where you can change the source property (you will here change the  image what is currently displayed) in the filter based on condition of you method. In this case the picture file should be already uploaded to the upload folder

2019-04-11_16-07-54.gifAnd for the 2d image widget the filter definition is some thing like this:

2019-04-11_16-12-00.gif

 

Top Tags