+ Start a Discussion
Blake TanonBlake Tanon 

Illegal empty right operand for operator '<=' in query '

Hello,

I'm getting an error when running a test on the follow piece of code... the underlined piece is where the error is coming from, any ideas on how to correct this?

 

System.DmlException: Update failed. First exception on row 0 with id a07c0000000fbUFAAY; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Trade: execution of BeforeUpdate caused by: line 17, column 1: Illegal empty right operand for operator '<=' in query 'select COUNT(id), WhoId from Task '.: []

 

Set<Date> PStart = new Set<Date>();
    for(Transaction__c t:trigger.new)
        PStart.add(t.Trade_Period_Start__c);
        
    Set<Date> PEnd = new Set<Date>();
    for(Transaction__c t:trigger.new)
        PStart.add(t.Trade_Date__c);
        
    Set<Id> cid = new Set<Id>();
    for(Transaction__c t:trigger.new)
        cid.add(t.rep__c);

    Map<String,Integer> callCountMap = new Map<String,Integer>();
        for(AggregateResult r:[select COUNT(id), WhoId from Task where Whoid in :cid AND (Type = 'Cold Call' OR Type = 'Inbound Call' OR Type = 'Outbound Call') AND Status = 'Completed' AND isDeleted = False AND (Date_Completed__c >=: PStart AND Date_Completed__c <=: PEnd) GROUP BY WhoId LIMIT 100 ALL ROWS])
            callCountMap.put(String.valueof(r.get('WhoId')),Integer.valueof(r.get('expr0')));

 

Andrew WilkinsonAndrew Wilkinson

The right hand operand is referring to the PEnd variable. In the error message it is saying this variable is empty.

sivaextsivaext

Hi 

 

where you used "PEnd" set  ? you are not filling any data into "PEnd" set. 

 

Set<Date> PStart = new Set<Date>();
    for(Transaction__c t:trigger.new)
        PStart.add(t.Trade_Period_Start__c);
        
    Set<Date> PEnd = new Set<Date>();
    for(Transaction__c t:trigger.new)
        PStart.add(t.Trade_Date__c);

In above code ,  i think the second set is wrong.

 

Please look into below code

 

 set<date> PEnd = new set<date>();

for(Transaction__c t:trigger.new) 

PEnd.add(t.Trade_date__c);\