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
NTNT 

How to display a Multicurrency symbol

 
 
 
Hi,

I have a VF page with custom controller. I am displaying an amount field on the page in a column of a pageBlockTable. Like:
<apex:column value="{!camp.Obj.Total_Budget__c}" headerValue="Budgeted Cost" />
Obj is a property in controller which returns a collection of sObject records.
Total_Budget__c is a custom field in the sObject.

My problem is if this field have value 1000, currency for this record is set to USD and my default currency is GBP than this field is displaying "GBP 1000" on the VF page which is wrong.

Please suggest me what should I do?

Nitin Gupta
Ron HessRon Hess

I cannot reproduce this problem.

 

here is my code

 

<apex:page standardController="SFDC_520_Quote__c"> <apex:dataTable value="{!SFDC_520_Quote__c.Quote_Lines__r}" var="f" > <apex:column value="{!f.Unit_Price__c}" ></apex:column> </apex:dataTable> </apex:page>

 

and here is my output

 

 

in this case my default currency is USD and the quote line items for this record are in JMD

 

the column component formats these prices showing both the current currency and my default (system default?).

 

What is your system default currency?

 

 

 

NTNT

Hi Ron,

 

Thanks for your response.

 

Please note that the problem is being faced with the Custom Controller and not with Standard Controller. Standard controller works fine. The scenario for which I am building the code requires me to use a Custom Controller.

 

 

Corporate currency for my Org. is set as USD as well as User default currency is also USD. If I create a Campaign with currency as GBP, then the VF page using a CUSTOM controller displays the currency code for that record as USD instead of GBP. It seems it is picking the currency code from the User record instead of Campaign record.

 

 

Example

 

I created a Campaign ("My Campaign") with the Actual Cost as GBP 1000.00.

 

The below code is displaying me ------  My Campaign  "USD 1,000" (instead of "GBP 1,000").

 

 

My CUSTOM Controller class is:

 

public class SampleClass

{

   public List<Campaign> getCampList()

  {

     List<Campaign> Camp = [select Name,ActualCost from Campaign];       return Camp;

  }

}

 

 

VF Page code is:

 

<apex:page Controller="SampleClass">

<apex:dataTable value="{!CampList}" var="f" >

    <apex:column value="{!f.Name}" />

<apex:column value="{!f.ActualCost}" />

 </apex:dataTable>

</apex:page>

 

Please suggest what could be the possible cause for this issue.

 

Thanks.

Ron HessRon Hess

Here you go:

 

 

public class SampleClass{ public List<Campaign> getCampList() { List<Campaign> Camp = [select Name,ActualCost,CurrencyIsoCode from Campaign]; return Camp; } }

 

 

 

NTNT

Hi Ron,

 

I won't be able to use "CurrencyIsoCode" field in Queries. This page is part of a Product that has to support orgs with Multi-currency feature enabled as well as disabled. If I add this field in the queries, package can be deployed only in orgs with this feature enabled.

 

That's the reason I am binding the object field directly in the VF page so that it automatically displays the correct currency code.

Regards,

Nitin

 

TehNrdTehNrd

Use Dynamic SOQL. This way you only query the CurrencyISOCode field if the org has enabled multi-currency. It's easy to determine if an org is using multi-currency:

Boolean isMultiCurrency = UserInfo.isMultiCurrency();

Message Edited by TehNrd on 02-27-2009 10:24 AM