on ‎2022 Feb 25 8:49 AM
Hello experts,
We have created an mdk project and connected it to our backend with thousands of data. When we deployed the app in Mobile Services Client, we are encountering a sync error after a couple of minutes (gateway timeout error) because of the bulk data:

Would you know how to load big data like this? Appreciate any inputs you may have.
Thank you!
Request clarification before answering.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi bing.fang,
Thanks for this, now i know where to see the retrieved data. I rerun the trace and saw that it is correctly returning the number of records. However in the display of the listpicker, there's still only one record displayed. I have not added any filter with the query options, i just specified the service and the entityset. I removed my rule first but it is still displaying a single record:

Hi bing.fang,
We have fixed the issue i just raised regarding the single record by adding some more key fields on the entityset. The question is, are we supposed to add the $top and $skip on the initializeOffline.action or where are we supposed to use it? Because when i tried to scroll down the list, it didn't load the next results.
The query options for initialize offline typically would not use $top or $skip. Most of the time you would retrieve all the records (no query options) or use a $filter to restrict based on some criteria. This action simply populates the offline db files. Then in your application when displaying a list MDK will automatically use $top and $skip to read / page the data as needed when scrolling an Object Table or List picker for example.
You can also use them in the app if needed (typically in conjunction with filters and other criteria)
Hi bill.froelich,
Is it possible for the user to always connect online and just define the specific items to be downloaded offline once he has loaded the records he wanted to use offline? As i understood from the mdk offline template, it always calls the initializeOffline.action which includes the defining requests for the selected odata entities.
Rachel,
I am not sure I fully understand your question but yes, you can add defining requests after the store is initially populated. What doesn't currently exist yet is a remove defining request option in MDK.
One approach would be to display an online list of items and allowing the user to mark the ones they then download offline for further processing. This assumes you have a backend service design that supports some kind of user selection storage and linking that when downloading the data. Having the backend handle the filtering for hte current user avoids issues with the defining requests on the client. Initially the equipment list (for example based on your screenshot) would be empty if the user has not selected equipment to download from on online lookup. Once the user selects what to download when they perform a delta sync the Equipment set would now return data since the user specified one or more items to download.
Hi bill.froelich,
Thank you so much for your response, this gives me other options to implement data fetching in our app. Regarding your first suggestion, how do we add defining requests after the store is initially populated? Currently, we have this equipment list data set in our defining request in the InitializeOffline.action, i have defined a query option for this to first get the 10,000 records. After this defining request, i wanted to call another defining request (thru custom code) that will get the next 10,000 records, then after this call another one until we get all the records.
Hi sopizaken.
I am a little confused. I guess that after you adding $top and $skip, there is no 504 issue and this issue is that the data downloaded is not correct.
About 504 issue. I mean that your backend server need support pagination mechanism. For example. If there are too many records for Entity Customers. When accessing /Customers, the response only return a part of data and add a next link in the end of the body. Then mobile server will continue to get the content of next page until no next link in the response body. The mobile service will send many requests to fetch all content.
About you said there is only a record after add $top and $skip. Please capture the network trace in the Mobile service's cockpit and attach the network trace file which is very useful to check the root cause.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
tracelog.txtHi bing.fang,
"I guess that after you adding $top and $skip, there is no 504 issue and this issue is that the data downloaded is not correct." - yes this is correct,
Regarding the 504 issue, our backend is already supporting the pagination mechanism. That's why when we run the top and skip in gateway client, it is returning the correct number of records.
I have attached the network trace for the single record returned after adding $top=10 and $skip=1.
According to the error message, it looks like the 504 code is from the backend server. You can use pagination mechanism to return the big data to avoid wait for long time without data.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi bing.fang,
I have tried to use $top and $skip in the queryoptions on InitializeOffline.action, but it is not working. It always returns a single record, regardless of the value assigned to $top, e.g. $top=5 returns 1, $top=100 still returns 1 record. But in gateway client, i can get the correct number of records when i try to use the $top. Would you know how to fix this issue?
I would suggest checking the logs of the backend odata server. Also check the Mobile Services logs to see if there is anything more that might be helpful. It also looks like there is more to the MDK Client error that might also be helpful so I would suggest checking the MDK client log as well.
I have loaded much more data than that into offline MDK apps so there should be no issue with loading that much data. Other than the time it might take.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 13 | |
| 8 | |
| 7 | |
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.