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

How can i get data by recordcount.

if i want to get data form recordcount=20 to 30, how to write the SOQL.


for example,it maybe [select rownum() as rownum,id from account where rownum  between 20 to 30]. 




Unfortunately there's no rownum for SOQL.


I don't think SOQL is designed to do queries like that. The best you can do is limit your retrieval to 30 records and then parse the resulting list in your Apex code by getting the last 10 records.


Best Regards,



well..i did something like that..but in javascript..not in is my code:

it used to work on the list view..i.e. when the list view was given and we check the boxes next to the did some operation on the click of a button..



{!REQUIRESCRIPT("/soap/ajax/15.0/connection.js")} {!requireScript("/soap/ajax/15.0/apex.js")} {!requireScript("")} var count=0,total=0; var orderList = {!GETRECORDIDS( $ObjectType.Orders__c )}; if (orderList == null || orderList .length == 0) { alert("Please select the orders you wish to update."); } else { var orderArr= new Array(); for (var i = 0; i < orderList.length; i++) { total++; var order = new sforce.SObject("Orders__c"); order.Id = orderList[i]; alert(order.Id); var id = order.Id; var result = sforce.connection.retrieve("Status__c", "Orders__c", [id]); alert(result); if(result[0].Status__c == "Shipping in Progress") { order.Status__c = "Completed"; orderArr.push(order); } else { count++; } } var callCompleted = false; try { var result = sforce.connection.update(orderArr); callCompleted = true; } catch(error) { alert("Failed to update Order with error: " + error); } alert("Out of '" + total +"' selected records,'" +count + "' of records could not be updated."); window.location.reload(true); }


 hope it helps..



Thanks for your solutions!


Has any best.....?


I think this case is important when we working in SFDC.