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
praiprai 

Getting Error System.QueryException: unexpected token: '.' in dynamic query

I am getting error while running the page.

First time when i run the page it is working perfect, but when i am running next time(Record more then 11) getting this error:

Here is code which i wrote:

String accSizeInInteger='select id,name,OwnerId,RepCode__r.Name,Tax_ID_Type__c,Tax_ID__c from Account where RepCode__c= \''+repblast.Current_Rep__c+'\'' ;
      
      if(ClientName!=null)
        {
            accSizeInInteger+=' and name like \'%'+ClientName+'%\'';
        }
        if(Type!=null)
        {
            accSizeInInteger+=' and Tax_ID_Type__c like \'%'+Type+'%\'';
        }
        if(doNotInclude.size()>0)
        {
            accSizeInInteger+=' and id not in '+doNotInclude;
        }
      
        List<Account> accListSize=new List<Account>();
        accListSize=Database.query(accSizeInInteger);

 

Please help any one.

Thanks

sfdcfoxsfdcfox
It looks like "doNotInclude" is either a list or a set, in which case you are probably going to get in trouble with the automatic toString() function that you're implicitly invoking. You'll need to convert the list or set into a comma-delimited, quote-enclosed list of values to not include.