Friday, September 14, 2012

Arithmetic operators not allowed in SOQL queries

Salesforce SOQL queries does not directly support arithmetic operations like below:

SELECT (FieldA+FieldB) FROM Account
SELECT (FieldA+FieldB)*100 FROM Account

We have to use formula fields to achieve this type of requirements.

Simply create a formula field and use it direclty in the query like below:

SELECT FormulaFieldA FROM Account



No comments:

Post a Comment