Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Hi,
I have a mashup that displays data from a Data table. I need mashup to auto refresh/update data whenever a row is added/deleted/updated in the Data table.
I can use auto-refresh function, but i need data to refresh only in case of changes to row in Data table.
Solved! Go to Solution.
Taking help from your comments, this is what i did:-
Hi @VR_10133499
Currently, we don't get any events triggered when DataTable gets altered. Based on how you are altering DataTable we can find some workaround.
Could you please explain when data will be added/deleted/updated in DataTable?
/VR
Hi,
I have a subscription on an entity from AMU application. whenever a new alarm is created in AMU application an entry is made in data table for the alarm using the subscription code.
Now whenever an entry is made in data table i need to refresh my mashup to show latest status of datatable.
Hi @VR_10133499
In this case, you will be using the AutoRefresh function but you won't query the dataTable value frequently.
/VR
There are 2 problems in this approach:-
1) adding a dummy/invisible widget breaks the existing layout of the mashup, invisible widget also takes some space in the UI.
2) It is still based on auto refresh but I need mashup to be refreshed instantly on data table update.
/VR
Taking help from your comments, this is what i did:-
Hi @VR_10133499 ,
I am following your Post as I am also looking for the same solution. I wanna ask you how did you automatically updated the text field value on the mashup. Can you pls elaborate on that.
Thanks in advance.
VV
Technically speaking (and not changing the workaround suggested below), if you are speaking about ThingWorx Data Tables, they do have events for row CRUD operations:
The issue though, is that these events are server-side, perfectly usable in subscriptions, but unusable for client-side (mashups).
You can not trigger a Mashup activity (eg: service execution) based on a server-side event (even if they share the same name, "event", they happen in different places and are incompatible with each other).
If you're speaking about pure SQL tables. then it is correct we don't have directly in ThingWorx a way to detect when a CRUD event happened, but you can definitely create a trigger in PostgreSQL for example, that will issue a REST call to ThingWorx to let it know an add event happened (though this approach is not useful here, more in cases when rows are created by other systems).
There is another workaround you can use:
I suggest following Velkumar's approach, as at the end of the day you will find a way to reduce the widget impact on the layout and if you set the AutoRefresh at 1 second interval, it won't have such a big impact on the system.
I have a small question about Session Value. If User1 updates the DataTable and session value gets updated for User1. Will User1's session value be accessible by User2?
/VR
Hi @Velkumar ,
I'm sorry about the confusion, I did not read carefully all my reply before posting.
You can disregard this part below because it is effectively the same as your workaround.
I started writing it, then realized while writing it was not really useful, but forgot to delete it.
"There is another workaround you can use:
create a session variable, type DateTime
In backend, update this DateTime variable each time when a new row is added / deleted
Use an AutoRefresh to execute the GetGlobalSessionValues"