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
Matrix ReturnsMatrix Returns 

query for Batch class using String in Filter

i want to write this query='SELECT idHistorical__c,Name__c,HomeOutstandingValue__c FROM TLItem__c WHERE TLItem__c .Name__c=GLA1 OR TLItem__c .Name__c=GLA2';  

where GLA1='1200-food'; and GLA2='2000=rice' for my batch class how to write?
Best Answer chosen by Matrix Returns

You can write query = 'select id,Historical__c,Name__c,HomeOutstandingValue__c FROM TLItem__c WHERE TLItem__c .Name__c=\''+GLA1+'\' OR TLItem__c .Name__c= +'\'GLA2+'\''

In yorur query must be evaluated to field1='some value' or  field1='some other value'

Let me knoe if that helps.

Thanks and Regards,

Paras Bhatt