Creating a phone app that uses both local and server side entities, I need to fetch data from both sides. 

The server side contains majority of the data, the local side contains basically a list of Favourite UserIds. In order to display all the data on the screen, including which of the UserIds are favourites, I need to pass a list of Favourites UserIds to the server action that fetches the data to be displayed on the screen - I've done this part (converting to CSV to filter the data).

What I'm stuck on is that the screen will need to fetch the server side data when it is loaded. My Client Action that collects the Favouite UserIds to pass to the Server Action can only run after an Action like pressing a button. 

How would I collect the local Favourite UserId List to pass to the server action, prior to the server action fetching the data to be displayed.

(hopefully this makes sense)

Hi Chris,

You may fetch the client data in the Initialize event of the screen and store the result in a screen variable that you then use in the server aggregate. But this also has a performance penalty, since the render will only start after the Initialize event handler finishes its execution, which will only be after fetching the data from the local storage. You may look at this article to better understand screen lifecycle events:

Other alternative to Carlos' proposal is to define an OnAfterFetch event for the Local Storage Aggregate, that calls the Server Action and assigns its result to a Local Variable. It has the advantage that it won't slow down the fetch of other data sources.


Paulo Ferreira