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
trishtrish 

ERROR at Row:1:Column:132 unexpected token: WHERE

Hi,

 

I am trying to use a standardsetController in conjunction with standard list view. Since, my data base has more than 10,000 objects, if I do not LIMIT the number of records returned by the database.getQueryLocator method, then I get an error - Too many query locator rows: 10001

 


Here's the code snippet that returns the record set -

 

public ApexPages.StandardSetController setCon {
            get {
               if(setCon == null) {
                
                   setCon = new ApexPages.StandardSetController(database.getqueryLocator([SELECT name,Home_Phone__c,Work_Phone__c,Mobile_Phone__c,email__c,Email2__c,City__c from Candidate__c LIMIT 10000]));
                   
                }
               return setCon;
              }
            set;
       }
public List<Candidate__c> getCandidates() {
           setCon.setPageSize(25);
           return (List<Candidate__c>)setCon.getRecords();
       }
 

 

 

However, if I add a LIMIT CLAUSE to my SOQL query, then, when I change the ListView filter to give me a list of objects where the state is set to "CA", I get the following error -

 

ORDER BY Name ASC LIMIT 10000 WHERE ((State__c = 'CA')) ^ ERROR at Row:1:Column:133 unexpected token: WHERE

Message Edited by trish on 03-16-2009 01:52 PM
JimRaeJimRae

Your where clause should be before the "order by" and the limit.

 

WHERE ((State__c = 'CA')) ORDER BY Name ASC LIMIT 10000

trishtrish

I guessed the error is because of the malformed query. However, I am not building the WHERE clause in my code.

 

This error is thrown when I change the standard list view selection(the Views dropdown). My assumption is that the Force.com engine automatically appends the filter condition based on the filterId to the Database.Querylocator's query. In this case, since the query ended with a LIMIT 10000, the WHERE clause got appended after the LIMIT clause.

 

Is this a bug??

 

 

 

MarkL.ax269MarkL.ax269

I think it's a bug, I'm getting the same error using the same circumstance - standardSetController and a list view with more than 10,000 records.  The strange thing is it's intermittent.  Sometimes I can run the page without an error and sometimes it errors for me.  Other users will error every time.  At this time I'm rewriting my page to not use list controllers, just too many issues with them.

 

Mark

irfan azizirfan aziz
I faced this issue while submitting http requests. The issue was caused because i was adding the limit clause in the SQL. After removing the limit clause it went without error.