Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Hi all,
I've been developing in Thingworx for a while now and I was wondering if it was possible to reference a Widget Property in a service, something like:
if (condition) {
[WidgetProperty] = [Something];
} else {
[WidgetProperty] = [SomethingElse];
}
I know that Widgets have pre-defined services and inputs/outputs but my question is: Could I write a code that defines the input of the property based on a condition? If possible, how do I reference this property in the service?
Thank you.
Solved! Go to Solution.
You can not access widget reference in Thingworx JS service .This is doable in Studio (which is another AR product ) using angular snippet . But as per Thingworx it is not feasible .But you can use expression/Validator widget to evaluate a JS expression(condition) and use the output to bind to widget services .
Thanks ,
Mukul Narang
You can not access widget reference in Thingworx JS service .This is doable in Studio (which is another AR product ) using angular snippet . But as per Thingworx it is not feasible .But you can use expression/Validator widget to evaluate a JS expression(condition) and use the output to bind to widget services .
Thanks ,
Mukul Narang
Thank you for your answer @mnarang !
I've never used the Expression/Validador Widget, could you help me understand how it works?
Regards,
Taciano
For expression widget - https://support.ptc.com/cs/help/thingworx_hc/thingworx_7.0_hc/index.jspx?id=ExpressionWidget&action=show
There is also a video link for how to use expression widget in above link .
For Validator widget - https://support.ptc.com/cs/help/thingworx_hc/thingworx_7.0_hc/index.jspx?id=ValidatorWidget&action=show
One more: - https://www.ptc.com/en/support/article/CS250781
Let me know if you face any problem after seeing these links .
Thanks ,
Mukul Narang
Ok @mnarang , I saw the articles and videos and I am trying to see how it would work for me.
Let me explain the situation:
For example, I have a Data Table called People with two fields (Name [String], Numbers [InfoTable]). The Infotable Numbers has two fields (Number [Integer], Name [String]). My problem is that I have a Widget in which I am showing the data of a People's selected row's Numbers, keep this in mind. However, when the user clicks "Add Person" in the People Data Table, i want to create a Data Table entry but also show the Numbers Infotable being created adding some rows to the Infotable. How can I use the same Widget to show both of the data.
Basically, I want to activate an Adding Mode, not having to create another mashup and using the same widget.
Regards,
Taciano