You need to sign in to do that
Don't have an account?
John Neff
How do I add a WHERE condition to my controller?
Hello!
I would like to add a condition to my controller so that only records that match a certain field value will be evalueted... but I can not get the syntax correct. Here is what I currently have:
And I would like it to function as:
[Select id, name, Call_Volume_This_Week__c, Spend_Last_Week__c, Week_to_Date_SpendFRM__c, Record_Scope__c from Buyer_Performance__c WHERE Record_Scope__c = "YES"]
How would I properly execute this?
Thanks,
John
I would like to add a condition to my controller so that only records that match a certain field value will be evalueted... but I can not get the syntax correct. Here is what I currently have:
[Select id, name, Call_Volume_This_Week__c, Spend_Last_Week__c, Week_to_Date_SpendFRM__c, Record_Scope__c from Buyer_Performance__c]
And I would like it to function as:
[Select id, name, Call_Volume_This_Week__c, Spend_Last_Week__c, Week_to_Date_SpendFRM__c, Record_Scope__c from Buyer_Performance__c WHERE Record_Scope__c = "YES"]
How would I properly execute this?
Thanks,
John
Try using single quotes instead of double quotes in WHERE ...
WHERE Record_Scope__c = 'YES'
All Answers
What syntax error are you getting?
Delete the following - WHERE Record_Scope__c = "YES" then save the file. If it saves then edit it again and re add that line of code but type it out, do not paste it.
I will try and convert the field to a Checkbox and see if I can just use TRUE.
Try using single quotes instead of double quotes in WHERE ...
WHERE Record_Scope__c = 'YES'
Thank you so much Priya!
I am glad... I could help !
Thanks again!