Hi,
We have Data Action option in mobile screens which perform a server hit. Data Actions in online screens allow developer to fetch and pre-process data before it is displayed on screen.
For offline screens since the server hit throws an exception, developers have to take the work around of adding an aggregate to fetch data from dummy local entity and do the pre-processing in its OnAfterFetch event. Is there a better alternative to achieve this in offline mode?
Hi Junaid,
D you mean screens that are meant to be used only offline? You can use the OnInitialize and OnReady for those.
If you mean processing something when a data action fails, you can use the OnAfterFetch of the data action itself.
If you give more details about your use case, I can try to help you more.
Afonso Aguas wrote:
Hi Afonso, that is exactly what we have done, but then OutSystems does not recommend doing heavy processing in OnInitialize and OnReady events and displays performance warnings. At high level we are picking values from input parameters, doing some assignments and then fetching data based on the provided inputs.
You can call a Client Action from a javascript block.
So you could make an asynchrounous call to the action that executes the processing in either of those event handlers without blocking the screen rendering.
EDIT:
Actually following my own advice, I'm trying to implement an asynchronous call in the platform, but the screen rendering always gets hanged by the execution of the function I'm trying to execute asynchronously. Maybe someone else can help out with this.
Junaid Ahmed Syed wrote:
For purely offline screens, I think developer shouldn't be implementing Data Actions at all, because as you said - server data is not available. Your workaround in these situations is perfectly valid and something I'm using to overcome these situations as well.
There are other workarounds, but they approach the problem from different angle and may or may not suit your needs: