function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
daniel.duartedaniel.duarte 

Currency Formatting Question - Location

Hello,

When I add a table column related to a currency field, VisualForce automatically formats the rows with the currency symbol and number separators. For example:

<apex:pageBlockTable value="{!CustomObject__c}" var="varname">
	<apex:column value="{!varname.Custom_Currency_Field__c}"/>
</apex:pageBlockTable>

I couldn't find out what currency format does it use (associated with the browser or user's language, for example). I changed my Location in My Personal Information but the currency format in the VF page didn't change, so I guess it's not related to the user's settings. I wonder if anyone knows how to set the currency format. I found a lot of examples to manually format the output field, but that's not what I need, I need something similar to the Translation Workbench feature, that translates my customizations to the user's language. I want to know if is there a stantard function that "translates" the currency, or if I can achieve this through the Force.com IDE and the Translation Workbench.

Thanks

daniel.duartedaniel.duarte

I just found out the answer to one of my questions. I didn't know where the currency shown in VF pages was defined, and I found out that it's defined in Setup > Company Profile > Company Information > Currency Locale Field.

Now what I need to know is that if there is a way of changing it according to the user's settings.

Another question: how does the Translation Workbench work? I mean, it translates to what language? The user's browser language? The user's language defined in the Force.com?

SatgurSatgur

One clue that I can provide here is datedExchangeRate table, where SFDC maintains the translation between Org level default currency & different other currencies.

 

You know that when you enter an amount, SFDC will store this in base currency in Database. Whenever a User belonging to a locale setting opens the record (SFDC looks at DatedExchangeRate table for an entry providing conversion from base currency to User locale currency, converts the amount to user's locale currency) and shows on the page.

 

I believe once that definition is in place, SFDC should be able to handle what you are looking for.

 

-Satgur

daniel.duartedaniel.duarte

Thanks Satgur.

As I was thinking about this issue I realized that what I want is a lot more related to number formatting than to currency specifically. For example, in my country the decimal separator is comma, like "123.456,78", so I would like to display a double value with a comma instead of a dot. But I don't want to do this hard-coded, using something like {0,number,$#,###.##} that I saw in some examples. I want to retrieve the user location and do this dynamically, assuming that there will be users from different locations and I want to be able to format date, currency and other number fields for each user. It's similar to what Translation Workbench does for labels. Maybe I could even use Translation Workbench for this, but I don't know how.