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

Show different messages based on the input text on button click in ThingWorx studio

dsengupta-21
2-Explorer

Show different messages based on the input text on button click in ThingWorx studio

I have one text input widget, one button and one label. I want to bind button to the text input such that if the text input is "XYZ" , the button click will show a message "abc", if the text input is "PQR" the button click will show a message "DEF" and so on. Is there any way to achieve it?

2 REPLIES 2

From a design point of view, I would create a service.

The service should have a STRING input and output.

In the Composer, when building the Mashup you can then map the text input as input parameter for the service.

The label will then be mapped to the output of the service.

The button should trigger service invokation.

The service itself can then use the input and run through if cases or switches and deliver an output result that matches your expectations.

With this, when you enter something in the text box and click the button the service is called, return a result that's then showing up as a text for the label.

/Michael

Hi Dipika Sengupta​,

Another alternative way could be to add an Application Parameter and write Angular JS functions for each button to update the Application Parameter according to the condition.

So, on click of button; the Application Parameter will be updated which in-turn is linked to the message/label widget.

I hope it helps.

Announcements


Top Tags