function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
HoustonAPlusHoustonAPlus 

QueryMore example for zksforce

I have tried to implement the querymore to retrieve more than 200 records but unfortunately it is not retrieving additional records. Is there a basic example demonstrating queryMore pattern?

Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell

you just need to pass the queryLocator to queryMore, if its still not done, pass the new queryLocator to queryMore and so on, something like.

 

ZKQueryResult *qr = [client query:someSoql];

// do something with [qr records]

while (![qr done]) {

    qr= [client queryMore:[qr queryLocator]];

    // do something with [qr records]

}

// all done

All Answers

SuperfellSuperfell

you just need to pass the queryLocator to queryMore, if its still not done, pass the new queryLocator to queryMore and so on, something like.

 

ZKQueryResult *qr = [client query:someSoql];

// do something with [qr records]

while (![qr done]) {

    qr= [client queryMore:[qr queryLocator]];

    // do something with [qr records]

}

// all done

This was selected as the best answer
HoustonAPlusHoustonAPlus

Thanks. I also referred to your SOQL Explorer application on github (https://github.com/superfell/SoqlX/blob/master/AppExplorer/Explorer.m), very helpful. Thanks again.