• Mahesh Reddy 72
  • NEWBIE
  • 0 Points
  • Member since 2016
  • Salesforce Developer
  • Web patashala solutions pvt ltd

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 0
    Replies
i facing this type of error in my class,
System.QueryException: unexpected token: By 
Class.PaginatoinExampleProgramForJob.__sfdc_setCon: line 9, column 1
Class.PaginatoinExampleProgramForJob.getAccounts: line 18, column 1

And under this is my class
public class PaginatoinExampleProgramForJob {
    Public integer noOfRecords{set; get;}
    public integer size{set; get;}
    public Apexpages.StandardSetController setCon{
        get{
            if(setCon == null){
            size=10;
            string query='SELECT Name, Type, Billingcity, Billingstate, BillingCountry FROM Account Ordered By Name';
            setCon = new ApexPages.StandardSetController(Database.getQueryLocator(query));
                setCon.setPageSize(size);
                noOfRecords = setCon.getResultSize();
        }
            return setCon;
    }set;
}
    public list<Account> getAccounts(){
        list<Account> acclist=new list<Account>();
        for(Account a :(list<Account>)setCon.getRecords())
        accList.add(a);
        return accList;
    }
    public PageReference refresh(){
    setCon = null;
    getAccounts();
    setCon.setPAgenumber(1);
    return null;
}
}