Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
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.
Solved! Go to Solution.
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.
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!
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.
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)
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.
Your explanation is very helpful to us, thank you very much