+ 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.