Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
Hi!
I have a few huge data packets I am fetching through REST Api and I would like it to happen separately with async functions so users do not have wait for all of them to be fetched.
So what I have tried to do is: Create a custom async service which fires an event after data has been fetched, that event is listened by subscription which calls a custom Service which updates data in a Thing Property. So my question is: is there any other way to get that data to Mashup instead of using an Auto-Refresh widget.
What I hoped I could accomplish instead of using an Auto-Refresh widget:
1. Have a reference to a widget in a Service from where I could update the widget or bind data to it.
2. Call Mashup's Refresh function (at least Mashup["mashup"].Refresh won't work)
Thanks!
Solved! Go to Solution.
It's an infotable property? usually it isn't a good approach, but anyway, in order to get the DataChange event thrown on a Infotable event you should set it as DataChangeType=ON and when you set it's value you should set it explicitly:
var clonedInfotable = Resources["InfoTableFunctions"].Clone({ t1: me.myInfotableProperty }); clonedInfotable.AddRow({ newValues....}); me.myInfotableProperty = clonedInfotable; // <-- Explicit update of the property
You can use GetProperties on the mashup to get a push update when properties are updated instead of a continuous pull with AutoRefresh.
Here the documentation: http://support.ptc.com/help/thingworx_hc/thingworx_7_hc/#page/ThingWorx_Help_Center%2FThingWorxHelpCenterDITAFiles%2FMashupBuilder%2FMashups%2FMashupAutoUpdate.html
Forgot to mention that I tried that, but it doesn't work. At least if it doesn't need anything else than bind GetProperties.myInfoTable to Grid in Mashup and select 'Automatically update values when able' from GetProperties properties. Grid remains empty.
Don't know if it has something to do with the fact that I add the rows to info table from service?
It's an infotable property? usually it isn't a good approach, but anyway, in order to get the DataChange event thrown on a Infotable event you should set it as DataChangeType=ON and when you set it's value you should set it explicitly:
var clonedInfotable = Resources["InfoTableFunctions"].Clone({ t1: me.myInfotableProperty }); clonedInfotable.AddRow({ newValues....}); me.myInfotableProperty = clonedInfotable; // <-- Explicit update of the property
Yes.
I had the DataChangeType=ALWAYS cause that fires ALWAYS, hah.
Never thought about setting info table explicitly, of course that should do it. Silly me.
Thanks for help!