I'm writing a batch class that takes in a string, does the query and then passes the results to a method to process. I want to use the string in the query, but when I add it in I get the error:
Variable does not exist: versionFY
I set it above the string and in the load method but I'm not sure where I'm going wrong.
Example:
global class NPD_Batch_BudgetToolLoad implements Database.Batchable<sObject>
{
private String versionId;
private String versionFY;
private Map<String, Id> pStructureMap;
private Map<String, Id> practiceMap;
private static final String QUERY =
'SELECT Id,' +
.....
'FROM Revenue_Pipeline__c ' +
'WHERE Year__c = ' + versionFY;
public NPD_Batch_BudgetToolLoad(Map<String, Id> pStructureMap, Map<String, Id> practiceMap, String versionId, String versionFY)
{
this.versionId = versionId;
this.versionFY = versionFY;
this.pStructureMap = pStructureMap;
this.practiceMap = practiceMap;
}
global Database.QueryLocator start(Database.BatchableContext BC)
{
return Database.getQueryLocator(QUERY);
}
global void execute(Database.BatchableContext BC, List<Revenue_Pipeline__c> scope)
{
//NPD_BudgetingDataLoad.createProjectedRevenue(scope, versionId, pStructureMap, practiceMap);
}