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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Referencing Widgets in Services

tscur
13-Aquamarine

Referencing Widgets in Services

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.

1 ACCEPTED SOLUTION

Accepted Solutions
mnarang
17-Peridot
(To:tscur)

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 

View solution in original post

5 REPLIES 5
mnarang
17-Peridot
(To:tscur)

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 

tscur
13-Aquamarine
(To:mnarang)

Thank you for your answer @mnarang !

 

I've never used the Expression/Validador Widget, could you help me understand how it works?

 

Regards,

Taciano

mnarang
17-Peridot
(To:tscur)

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 

tscur
13-Aquamarine
(To:mnarang)

Thank you for your help @mnarang ! Will do.

 

Regards

tscur
13-Aquamarine
(To:tscur)

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

Top Tags