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, folks!
I know there were/are some discussions related to this topic, many of them were replied by sdidier, but unfortunately I couldn't find an exact solution to my problem.
I'm trying to read and write values between Thingworx and Vuforia.
I had no problems reading a value from a Thing in Vuforia using the GetPropertyValues service, as explained in this article. I'm able to instantly see the values updating in my experience when I manually change a property value in Thingworx, without issues.
However, when I try to do the reverse path - writing values to a Thing from Vuforia - using the SetPropertyValues service, I have no results.
Here's what I've done:
1. I've created a couple of 2D buttons that will change the state of a Boolean property of a Thing:
2. I've added the SetPropertyValues service from my Thing (staplerThing) and set it up as shown below.
3. I've done the appropriate (at least I think they are appropriate lol) bindings between the button's click event, the SetPropertyValues and GetPropertyValues services, as illustrated below:
NOTE: estadoTampa is the Boolean property I'm trying to write values to.
I've tried with many other bindings and had no success. The values aren't updated on Thingworx after I click the button (in preview mode).
Any help would be appreciated!
Thanks!!
Best regards,
Rafael Gomes
Solved! Go to Solution.
Hi @rgomes ,
I think this is should be no problem.
Here an simple example:
For this I defined one button , 2 checkboxs and one label.
The first Checkbox was the input parameter for the property in Thingworx which should be set or unset (true/checked or false /unchecked)
1.) In Thingworx I did:
1.1.) created a general thing with one boolean property "test_bool"
1.2) There I created service with one parameter. Val (boolean) The service will simple set the TEST_SERVICE thing ´property "bool_test" to the service argument "val"
2.) added the service in the external data
here :
2.1) the click event will call the Thingworx service "setBoolTest" of the Thing "TEST_SERVICE".
2.2.)The value of the checkbox 1.) has an binding to the service argument val.
2.3)The feedback back form Thingworx is via binding of the thingworx property directly without using an explicit service. The value is linked to the application parameter "bool_value"
2.4) And other hands the parameter "bool_value" has binding to the to the text property of the label widget and to the value property of checkbox 2.) But, because that the value (true or false) is converted to string I used a filter to convert it back to Boolean what is expected for the value setting of the checkbox 2.)
Hi @rgomes ,
I think this is should be no problem.
Here an simple example:
For this I defined one button , 2 checkboxs and one label.
The first Checkbox was the input parameter for the property in Thingworx which should be set or unset (true/checked or false /unchecked)
1.) In Thingworx I did:
1.1.) created a general thing with one boolean property "test_bool"
1.2) There I created service with one parameter. Val (boolean) The service will simple set the TEST_SERVICE thing ´property "bool_test" to the service argument "val"
2.) added the service in the external data
here :
2.1) the click event will call the Thingworx service "setBoolTest" of the Thing "TEST_SERVICE".
2.2.)The value of the checkbox 1.) has an binding to the service argument val.
2.3)The feedback back form Thingworx is via binding of the thingworx property directly without using an explicit service. The value is linked to the application parameter "bool_value"
2.4) And other hands the parameter "bool_value" has binding to the to the text property of the label widget and to the value property of checkbox 2.) But, because that the value (true or false) is converted to string I used a filter to convert it back to Boolean what is expected for the value setting of the checkbox 2.)
Roland, it's working like a charm. Thanks!
I wasn't expecting to create a custom service, though. I thought SetPropertyValues would take care of the job.
Thanks again! 🙂