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
sgoremasgorema 

Displaying Currency amounts in datatables

I have built VF pages to display and render our quote data to PDF format. One issue I am having is displaying the Quote Amount field. If I open up a quote that is in another currency other then my default currency the Amount fields displays something like this:
EUR 8,000.00 (USD 11,600.09)
 
This is fine in the UI but we do not want to see this on the quote. I just want to display the amount in the quote's currency. Currently my code is displaying it as seen above. Here is the code..thanks!
 
Code:
<apex:dataTable value="{!SFDC_520_Quote__c}" var="Quote" cellpadding="4" border="1" align="right">
            <apex:column value="{!Quote.Total_Charges_Calc__c}" width="100"/>
            <apex:column value="{!Quote.Quote_Amount__c}" width="126"/>
</apex:dataTable>

 
Stephanie
Ron HessRon Hess
something like this may work

Code:
<apex:dataTable value="{!SFDC_520_Quote__c}" var="Quote" cellpadding="4" border="1" align="right">
            <apex:column value="{!Quote.Total_Charges_Calc__c}" width="100"/>
            <apex:column width="126">
  <apex:outputText value="{!Quote.Quote_Amount__c}" />
  </apex:column>
</apex:dataTable>

 
if not then you may need a controller extension to format this the way you want.
sgoremasgorema
Thanks Ron. But this displays it  as EUR 8000.0 (missing a 0). So to get the correct number of digits after the decimal I will need a controller extension??
Ron HessRon Hess
Yes, formatting the can be done with a controller extension.
sgoremasgorema

Am working on the controller extension that would be needed for this and running into some problems. This is my first controller extension and I am unsure how it is that I need to get the field from the Quote object. Below is my code (which is essentially the code from the Developer's guide) but since quote_amount__c is not a text field I am getting an error. Can someone point me in the right direction?

 

Code:
public class quoteExt{

     private final SFDC_520_Quote__c quote;

        
    // The extension constructor initializes the private member
    // variable acct by using the getRecord method from the standard
    // controller.
    public quoteExt(ApexPages.StandardController stdController) {
        this.quote = (SFDC_520_Quote__c)stdController.getRecord();
    }

    public String getAmount() {
        return quote.quote_amount__c ;
    }
}


 

sgoremasgorema

I got a bit further with this but am not sure how to format this double data type to display as EUR 10,000.00..any ideas?

 

public class quoteExt{

     private final SFDC_520_Quote__c quote;

       
    // The extension constructor initializes the private member
    // variable acct by using the getRecord method from the standard
    // controller.
    public quoteExt(ApexPages.StandardController stdController) {
        this.quote = (SFDC_520_Quote__c)stdController.getRecord();
    }

    public Double getAmount() {
        return quote.quote_amount__c ;
    }
    public String getCurrCode() {
        return quote.CurrencyIsoCode ;
    }

}

sgoremasgorema
Hi everyone, I still have this as an open issue and am wondering if anyone has any suggestions. My premier support rep suggested I look at the solution found here: http://community.salesforce.com/sforce/board/message?board.id=Visualforce&message.id=897 but I cant seem to understand how this is going to work. Does anyone have any suggestions?