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
Michele ToscanoMichele Toscano 

expecting a right parantheses, found 'and'

I am having trouble with the syntax on line 28 (bolded below) – the error I receive says: ‘expecting a right parentheses, found ‘and’’
How can I correct that part? I want it to check to be sure the expiration date is less than today and that the status is not currently in manually expired or expired. If it passes, execute the batch expiration.

global class Batch_ExpDate_NoPricIn
{
global Database.QueryLocator start(Database.BatchableContext BC)
{
string manualExpStr = 'Manually Expired';
string expiredStr = 'Expired';

string query= 'select Id,RecordTypeId,RecordType.Name,Par_Status__c,Effective_date__c,Expiration_Date__c from Price_Authorization_Request__c where Par_Status__c !=:manualExpStr and Par_Status__c !=:expiredStr';

return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List Parlist)
{

if(Parlist != null && !Parlist.isEmpty())
{
for(Price_Authorization_Request__c parObj : Parlist)
{

List NprList = [select Id,Expiration_Date__c, PAR_Status__c from Price_Authorization_Request__c Where Price_Authorization_Request__c =: parObj.Id];

if(NprList != null && NprList.size() > 0)
{
Integer count = 0;
for(Price_Authorization_Request__c PARObjNpr : NprList)
{

if(PARObjNpr.Expiration_Date__c != null && PARObjNpr.Expiration_Date__c < system.today() && PARObjNpr.PAR_status__c !='Manually Expired' and PARObjNpr.PAR_Status__c != 'Expired')
{
count = count + 1;
}
}
}
}
}
}
global void finish(Database.BatchableContext BC)
{}
}

 
Best Answer chosen by Michele Toscano
UC InnovationUC Innovation
Just replace 'and' with && and it should work.