4

I have an aggregate query that groups my custom object records by 4-5 fields and then returns a sum of currency fields in each grouping. I have multicurrency enabled so this sum of the currency field is being returned in USD. :( Trying to convert the results back into CAD is causing issues with precision and rounding.

So I felt its best if I can do my own aggregation. So I have changed my query to return a list of the records and so far the best solution I found is to iterate repeatedly through my list and create groups and sum up their amounts but this is proving to be inefficient.

Can someone please suggest perhaps a better and efficient solution where we can acheive grouping NON Agrregate SOQL results. I know that almost everyone would prefer to use Aggregate queries to perform grouping but I am hoping someone had the need to do a similar thing. Thanks.

  • 3
    Share some code? There's no reason why aggregating data yourself should be inefficient if you're using the correct code constructs. – sfdcfox Jul 31 '13 at 17:12
1

You should try using "convertCurrency(field)" in your SELECT to retrieve field in the user's currency : http://www.salesforce.com/us/developer/docs/soql_sosl/Content/sforce_api_calls_soql_querying_currency_fields.htm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.