You need to sign in to do that
Don't have an account?
Sumant Kuchipudi
How can I get dynamic YEAR and MONTH in SOQL?
Hi,
I have below SOQL clause with Static Year and Month, is it possible to have dynamic values in those fields?
I have below SOQL clause with Static Year and Month, is it possible to have dynamic values in those fields?
( ( ( YEAR__c=2016 and Month__c='July' ) or ( YEAR__c=2016 and Month__c='August' ) or ( YEAR__c=2016 and Month__c='September' ) or ( YEAR__c=2016 and Month__c='October' ) or ( YEAR__c=2016 and Month__c='November' ) or ( YEAR__c=2016 and Month__c='December' ) or ( YEAR__c=2017 and Month__c='January' ) or ( YEAR__c=2017 and Month__c='February' ) or ( YEAR__c=2017 and Month__c='March' ) or ( YEAR__c=2017 and Month__c='April' ) or ( YEAR__c=2017 and Month__c='May' ) or ( YEAR__c=2017 and Month__c='June' ) ) OR YEAR__c=null ) )
On the other hand, you could define the Month_Year__c field as a date formula: And then you can use the SOQL date operators: Let me know if you have any questions.