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
Rakesh RRakesh R 

Value of filter criterion for field must be of type double and should not be enclosed in quotes

Hello folks,

I am writing a dynamic query and comparing a formula(Ineger) field called Age_of_Call_in_Days_abv__c in my object, but getting bellow error.
"System.QueryException: value of filter criterion for field 'Age_of_Call_in_Days_abv__c' must be of type double and should not be enclosed in quotes"

Below codes which am writing 

String orgName = 'Agri';
String profileId='00eF0000000yQWE';
Double minAge = 7.0;
Double maxAge = 30.0;
String query = 'Select Id, Name, Call_Type_vod__c,Account_vod__c, Age_of_Call_in_Days__c, Late_Submission_Approval_Status_abv__c,  from Forma__c'
                            + ' where Organization_abv__c !=\'' + orgName +'\''+
                        ' AND owner.ProfileId =\'' + profileId + '\''+
                        ' AND Age_of_Call_in_Days__c>=\''+ minAge + '\''+
                        ' AND Age_of_Call_in_Days__c<=\''+ maxAge + '\'' + ' LIMIT 2';


Please help me.
Danish HodaDanish Hoda
Hi Rakesh ,
I can't find 'Age_of_Call_in_Days_abv__c' in your dynamic SOQL. Could you also share the formula you have used in the field?
Rakesh RRakesh R
Hi Danish,

i change the field name with 'Age_of_Call_in_Days__c' instead of  'Age_of_Call_in_Days_abv__c,. 
after that i am getting below error.
"System.QueryException: value of filter criterion for field 'Age_of_Call_in_Days__c' must be of type double and should not be enclosed in quotes"
Danish HodaDanish Hoda
Hi Rakesh,
Use below query : 
String query = 'Select Id, Name, Call_Type_vod__c,Account_vod__c, Age_of_Call_in_Days__c, Late_Submission_Approval_Status_abv__c,  from Forma__c'
                            + ' where Organization_abv__c !=\'' + orgName +'\''+
                        ' AND owner.ProfileId =\'' + profileId + '\''+
                        ' AND Age_of_Call_in_Days__c>='+ minAge +
                        ' AND Age_of_Call_in_Days__c<='+ maxAge + ' LIMIT 2';