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
giri rockzzzzgiri rockzzzz 

Prblem with date comparison in dynamic soql....plz help

Compile Error: unexpected token: 'billStart' in last line ....can anyone help me ????

 

 

 public Date billStart;

  public Billing_Period__c inNewDate1;

  billStart = [Select Billing_Date__c from Billing_Period__c Where Id=:bl LIMIT 1].Billing_Date__c;

 

  billStart1 = billStart.addMonths(1);
        billStart2 = billStart.addMonths(2);
        billStart3 = billStart.addMonths(3);
        billStart4 = billStart.addMonths(4);
        billStart5 = billStart.addMonths(5);

 inNewDate1=[select Id from Billing_period__c where Billing_Date__c=billStart];

 

 

Imran MohammedImran Mohammed

You are missing colon(:) in the query.

inNewDate1=[select Id from Billing_period__c where Billing_Date__c = :billStart];

 

I would like to get your attention to the first query you have. The way you have the query to get Billing_Date__c may end you with null pointer exception.