Based on salesforce Documentation currency based where clauses are of the form: WHERE Object_name Operator ISO_CODEvalue
Sample query would look like:
SELECT Id, Name FROM Opportunity WHERE Amount > USD5000
See the USD before 5000 to specify the currency. But the documentation doesn't describe how to deal with negative values.
I have tried followings and all of them fail with parsing error from salesforce.
SELECT Id, Name FROM Opportunity WHERE Amount > USD-5000
and
SELECT Id, Name FROM Opportunity WHERE Amount > -USD5000
which throws:
{ "message": "\nName FROM Opportunity WHERE Amount > -USD5000\n ^\nERROR at Row:1:Column:49\nunexpected token: 'USD5000'", "errorCode": "MALFORMED_QUERY" }
What is the proper way of using ISO_CODEvalue for currency fields when the query requires negative values?
Based on comment below, I have also tried following query:
SELECT Id, Name FROM Opportunity WHERE Amount >-1*USD5000
Salesforce throws following exception:
{ "message": "\nFROM Opportunity WHERE Amount >-1*USD5000\n ^\nERROR at Row:1:Column:49\nunexpected token: '*'", "errorCode": "MALFORMED_QUERY" }
Note: I have previously asked this question in stackoverflow.