Initialize local storage with cloud data

I am attempting to create a simple phone PWA to store my DVD movie collection info. I am using Windows 10 and Outsystems 11.6.31. I test in Chrome 80.0.3987.149 (64-bit) and on my Samsung Galaxy S9+ running version G965USQS7DTB1 O/S. 

I created the App and the default module. I imported the entity from excel into the Database and confirmed the data by viewing it. I then  added the entity to local storage from the Database. The entity was created with the proper attributes. I then created a home screen and added a list widget to it. I then dragged the LocalMovies to the list widget and deleted the unused entity attributes from the list. I next opened the OfflineDataSync logic folder and configured OfflineDataSyncConfiguration by setting True on all the assignments listed there. At this point I published the app. I went to the distribution tab and turned on the Distribute App as a PWA. I opened the app in Chrome and no data shows on the screen. I opened the developer tools and  looked at the application tab where I checked for data under Storage/WebSql/Movies where the local data is stored. I see the Entity metadata is there in the OSSYS_ENTITY table but no data is ever placed in the LOCALMOVIES table.

I am new to Outsystems but I have read and tried just about everything I can find to resolve this and would truly appreciate any guidance. I have attached a xls file with the data and a copy of the OML file.

Your data xls sheet is missing. Try to reupload it.

Hi Charles,


I can open your oml but please share xls file to look further

Sorry, I had attached the XLS file prior to the OML without realizing I could only attach one at a time. 

Here is the XLS file.


Solution

Hi Charles,

I found many required code missing in your implemented action flow, which is why you are not able to get the expected result.

If you want the sync process to get initiate there must me a medium/trigger point i.e. an application Login flow, or explicitly call of OfflineDataSync action etc.


Observation:

1) In your case the MovieList  screen is set to Anonymous screen i.e. non-registered user can access the screen which means no trigger point to initiate the Offline Data Sync activity.

2) Because of the (1) point, you have define the explicit call for the OfflineDataSync Client action. We do have below mentioned options to explicitly call the OfflineDataSync Client action.

     i) MovieList - OnInitialize action flow - which is not that optimized solution (it will impact the screen rendering activity)

    ii) Define the OnApplicationReady system event - within the action flow, call the OfflineDataSync Client action to initiate the data sync process.


Note:

1) Please observe the OfflineDataSync Client action - within the flow I introduced SyncLocalMovies client action for performing the syncing process for Local Movies table.

2) I bypassed the RegisteredRole check code within the SyncMovies Server Action flow, as we are allowing the MovieList screen to be accessed by Anonymous user.


PFA - Updated the .oml solution module


Check this out - Demo App


Hope his helps you!


Regards,

Benjith Sam

Solution

Benjith,

I really appreciate your help. I am going to start from scratch and rebuild my little app using the guidance you provided.

Charlie

Charles Chapman wrote:

Benjith,

I really appreciate your help. I am going to start from scratch and rebuild my little app using the guidance you provided.

Charlie


I'm glad I could be of help.


Regards,

Benjith Sam