How do I get the WHOLE table downloaded?

Are you looking for help?

This is a support forum for reporting issues related to Backendless services. Please note that due to our support policy we cannot provide you help with debugging your code, consulting in regards to any language or third-party library usage. For this kind of questions we recommend using more appropriate forums like Stack Overflow.

In order to suggest you a quality solution, we shall usually ask you to provide the details mentioned below first. Including them into your topic right away helps us to start investigating your issue much faster.

In case you have a suggestion or an idea, the details below are not always required, though still any additional background is welcome.

Backendless Version (3.x / 5.x, Online / Managed / Pro )

3.x, online

Client SDK (REST / Android / Objective-C / Swift / JS )

Swift

Application ID

F834DC16-02BF-39F7-FFCB-D5BCBE170300

Expected Behavior

Please describe the expected behavior of the issue, starting from the first action.

  1. Code tries to access all the content in the “Student” table.
  2. All records downloaded and saved in the “allStudents” array.

Actual Behavior

Please provide a description of what actually happens, working from the same starting point.

The code below runs, but only 10 results are returned. They are in a consecutive block somewhere in the middle of the table. Not sure how to access the rest of the table, even with paging – how is that supposed to work? The documentation says that the paging involves blocks of 100 elements, but only 10 are returned. We noticed the same behavior trying the REST interface on the web client as well.

Here is the Swift code, in case that helps:

func loadDataFromTable() {
    let readStore = backendless.data.of(Student.ofClass())
    Types.tryblock({() -> Void in
        // fix this please
        allStudents = readStore?.find() as! [Student]
        
    },
                   catchblock: { (exception) -> Void in
                    print("Server reported an error: \(String(describing: exception))")
    })
    print("Load done!")
    
}

Reproducible Test Case

Please provide a simple code that could be run in a new clean app and reproduce the issue.

If the issue is more complex or requires configuration, please provide a link to a project on Github that reproduces the issue.

I can produce a simple test case if that seems necessary.

Hello,

To get up to 100 objects with a single request, you need to use the page size argument in DataQueryBuilder. Please see the following page in the documentation:
https://backendless.com/docs/ios/data_data_paging.html

Regards,
Mark

Hi Roger

Also you can implement a simple api service for retrieving the entire table in a single api call, here is an article which will be helpful for you https://backendless.com/using-codeless-to-retrieve-more-than-100-objects-with-a-single-client-side-api-call/

Regards, Vlad

I tied to follow along with the article but can not figure out how to add variables to the method code.

Look for the “Variables” section in the list of codeless blocks on the left side. That’s where you declare variables and see the blocks to work with variables.

1 Like

maybe this will help:

1 Like