I am reading two currency fields from a custom object, displaying them and their difference on the vf page.
I am using outputfield to display my currency fields, so if the locale currency of the user is GBP or EURO, the currency is automatically converted from the default USD. The problem comes when displaying their difference. It is displayed in an outputtext (as I cannot use outputfield for a non sobject).
I dont want to go go through a whole lot of calculations and function calling to display this difference in the locale currency. So is there a way to do this efficiently?
PS: I tried using convertCurrency() in my SOQL query hoping to get the fields converted into locale currency and then subtracting the local currency values, but it is not working (I still get those fields in the default currency USD).
Something like this:
CustomObjA cust = [select convertCurrency(customCurrencyField1), convertCurrency(customCurrencyField2) from CustomObjA where Id = :recordId limit 1];
Decimal difference = cust.customCurrencyField1 - cust.customCurrencyField2;
Any ideas on how I can achieve this.