You could try creating a StandardSetController based on your query and call the previous() and next() methods to move through the set and getRecords() to get the next set back. It won't be as flexible as you want (20th to 50th) would need a page size of 10 and lots of next calls. Anyway thought I would mention it just in case.
You have to create the subset yourself using a for loop. This works fairly well, unless your primary set is larger than 1000 elements, which is the limit for a list.
I have done it like this:
List<Account> Accts = new List<Account>([select id,name from account limit 1000]);
List<Account> p2Acct = new List<Account>();
for(Integer i=20;i<70;i++){ //pick records 20 through 50 in list
p2acct.add(Accts[i]);
}
You could try creating a StandardSetController based on your query and call the previous() and next() methods to move through the set and getRecords() to get the next set back. It won't be as flexible as you want (20th to 50th) would need a page size of 10 and lots of next calls. Anyway thought I would mention it just in case.
Thanks, it didn't really fix the problem as I was trying to be cheeky and get around the 10,000 rows problem. I think I'll just have to find another way around.
You could try creating a StandardSetController based on your query and call the previous() and next() methods to move through the set and getRecords() to get the next set back. It won't be as flexible as you want (20th to 50th) would need a page size of 10 and lots of next calls. Anyway thought I would mention it just in case.
All Answers
You have to create the subset yourself using a for loop. This works fairly well, unless your primary set is larger than 1000 elements, which is the limit for a list.
I have done it like this:
List<Account> Accts = new List<Account>([select id,name from account limit 1000]); List<Account> p2Acct = new List<Account>(); for(Integer i=20;i<70;i++){ //pick records 20 through 50 in list p2acct.add(Accts[i]); }
You could try creating a StandardSetController based on your query and call the previous() and next() methods to move through the set and getRecords() to get the next set back. It won't be as flexible as you want (20th to 50th) would need a page size of 10 and lots of next calls. Anyway thought I would mention it just in case.
Thanks, it didn't really fix the problem as I was trying to be cheeky and get around the 10,000 rows problem. I think I'll just have to find another way around.
Thanks Anyway
James