You need to sign in to do that
Don't have an account?
Siddharth
Paging with query more
Hi,
Urgent is required.
We have a situation where in we need to get 10000 contact records but in a batch of 50. We need to bind the datasource to a gridview (page size 50) control with paging. When we click on page 2 then it should get us only next 50 records and not the whole datatable from salesforce.
Thanks in advance,
Sidd.
The reason why order by is important is that if you don't use it you will get the records in an essentially random order. If your use wants to resort your table, you will have to clear the data and issue a new query using the new order by column.
Dave – Thanks as always for your thoughtful response. We see how to get the first 200 records by applying “limit” and “order.” From your response it was not clear how we would get records 201 to 400 even if we have current page and record number range. Could you give a line of SOQL that demonstrates how to do this?
SQL Server 2005 supports the notion of a rownumber function. Please see http://aspnet.4guysfromrolla.com/demos/printPage.aspx?path=/articles/031506-1.aspx to see what I am talking about. So the question here is does the SFDC API support this type of functionality ?
If the answer to the question about rownumber is that it’s not supported then do you have a recommendation about how we could provide the ability to efficiently page through large tables? The answer may well be that we have to restrict the user to a manageable result set.
Many thanks,
Scott
Cheers
Hi Dev,
Thanks for the reply.
With SQL Server if we write query like this then we can get 10 records at a time. In this query we are getting records from 41-50. We can change this 40 to any number like 10, 20, 30, etc. Can we write a query like this with API.
SELECT * FROM (SELECT TOP 10 * FROM
(SELECT TOP 40 *
FROM TempData
ORDER BY CustomerId) A
ORDER BY CustomerId desc ) B
ORDER BY CustomerId
Assuming page size is 10. 40 is multiplication of page size and page number.
It would be a great help if you could provide an example.
Thanks again in advance.
SELECT * FROM (SELECT TOP 10 * FROM
"(SELECT TOP 40 *
FROM TempData
ORDER BY CustomerId) A
ORDER BY CustomerId desc ) B
ORDER BY CustomerId
select id, name from account order by name desc limit 25