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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

how to refresh mashup when service return data changed?

CZ_9645217
15-Moonstone

how to refresh mashup when service return data changed?

Dear community,

 

I wrote a Mashup and a service. The logic of the service is: the input parameter is a data from the PLC. After a series of processing, the service generates a data as an output parameter, and then binds the output data to the mashup.

 

Now I want to realize that when the PLC data changes, the data displayed by Mashup automatically changes, what should I do?

 

I tried to use the AllDataChanged function, but it failed.

 

 

 

 

 

 

ACCEPTED SOLUTION

Accepted Solutions

The backend of TWX, ie. Subscription, can respond to PLC change as soon as possible, and you can use it to send out email alert and other reactions. Mashup is just a place to present the situation to viewer. By using a 1 s auto-refresh widget to update the warning status, the user will only get the message at most 1 second late, and if you've configured automatic response to the incident, it will be taken care of before User noticed, the delay in mashup won't be much of a problem.

View solution in original post

8 REPLIES 8

One of the way - On the mashup it self you can use autorefresh widget's refresh event to call that particular service in a time interval. The time interval can be decided on the basis of data change frequency of the PLC data. You can set the time in widget property itself.

CZ_9645217
15-Moonstone
(To:mnarang)

Thank you very much for your quick reply, because the value of PLC will change from time to time, so I can’t use autorefresh. Is there any change in plc value to trigger the update of mashup? Looking forward to your reply. Thank you!

anarwal
13-Aquamarine
(To:CZ_9645217)

Hi @CZ_9645217 ,You can use  GetProperties service if you just want the data from the device. In the Data Properties panel, when the Automatically update values when able check box is selected and the mashup is viewed, the mashup run time creates a websocket connection with the ThingWorx Platform and subscribes to the properties that are bound to widgets.

 

If its a custom service you can go with auto refresh widget.

CZ_9645217
15-Moonstone
(To:anarwal)

Thank you very much for your quick reply, because this is a customized Service, is there any solution to trigger the update of the mashup by changing the service output value? Looking forward to your reply

The tricky part is turning an input/property change to an event in the mashup, so that other services can be triggered, such as the refresh service in Mashup.

 

Value change can trigger a subscription, but it cannot affect mashup, "Alldatachange" and autorefresh maybe the only solution.

 

You can use the PLC data change to record data history to ValueStream, while apply the autorefresh in mashup; Thus the data won't get missed from your log, and the mashup would be more user friendly. (some mashup services may request a longer time to finish execution than your PLC data update frequency, and then the mashup won't be able to present all the data.  And if the remote data doesn't update that fast, an 1 s refresh interval won't be good enough for that)

CZ_9645217
15-Moonstone
(To:zyuan1)

Thank you very much for your reply, what you mean is to save the data to the database, and then cooperate with autofresh to display the data at regular intervals.

 

Now we want to make a panel to display the alarm information of the device. When the device has an alarm, we want to trigger the mashup update by changing the PLC value so that it can be displayed at the time. However, it seems that it cannot be triggered by this kind of thinking. Currently, it can only reduce customer expectations and use autofresh to control Mashup updates.

The backend of TWX, ie. Subscription, can respond to PLC change as soon as possible, and you can use it to send out email alert and other reactions. Mashup is just a place to present the situation to viewer. By using a 1 s auto-refresh widget to update the warning status, the user will only get the message at most 1 second late, and if you've configured automatic response to the incident, it will be taken care of before User noticed, the delay in mashup won't be much of a problem.
CZ_9645217
15-Moonstone
(To:zyuan1)

Your explanation is very helpful to us, thank you very much

Announcements


Top Tags