I have entity Question. Entity Question has property Number. I need to fetch every 20th question: 1, 21, 41, 61, etc. How can I do this?
I have entity Question . Entity Question has property Number . I need to
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Create an
NSFetchRequestas usual, as well as anNSPredicateinstance that uses a modulus operator, e.g. the following untested predicate:Add the predicate to the fetch request, and do the fetch, as usual.
Or create an
NSSetof ID values that include{1, 21, 41, ...}and use that with the predicate:I haven’t tested this, but either approach should get you close, I think.