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
we-mpwe-mp 

Currency field in table

Hello,

 

I have a custom object Currency field called re with a value of 12670660

In a VF page, I have a table row :

<td style="border-bottom:solid 1px #E3DEB8;padding:5px;text-align:right;">$&nbsp;{!WESearchResult__c.GC_REALESTATE_USED__c} </td>
                

 

 <td style="border-bottom:solid 1px #E3DEB8;padding:5px;text-align:right;">{!obj__c.re__c} </td> 

 

The value is displayed as 1.267066E+7. 

 

How can I correct this to display the number without the Exponential and with currency elements ($ sign and commas)


Thanks.

aballardaballard

Use <apex:outputField> to get the standard Salesforce rendeing of a currency field. 

SSRS2SSRS2

Also you can use

 

<td style="border-bottom:solid 1px #E3DEB8;padding:5px;text-align:right;"> 
  <apex:outputText value="${0, number,#,###,##0.00}">
     <apex:param value="{{!obj__c.re__c}" />
  </apex:outputText>
</td>

 -Suresh

 

we-mpwe-mp

Thanks Suresh.

 

When I add add apex:outputText to my table like you have mentioned, it messes up the layout of the table.  I looked at the page source and it is adding addiitonal colspans and other tags. 

 

 

 

 

   

 </td>

<td></td></tr><tr><td class="first data2Col " colSpan="2"><span style="border-bottom:solid 1px

#E3DEB8;padding:5px;text-align:right;">$0</span></td></tr><tr><td class="first data2Col " colSpan="2">
        </td>

 

Is there any way to work around this?

Thanks.

 

SSRS2SSRS2

I cannot think how it get additional attribute called calspan anyway overwrite the colspan by value 1.

 

<td style="border-bottom:solid 1px #E3DEB8;padding:5px;text-align:right;" colSpan="1"> 
  <apex:outputText value="${0, number,#,###,##0.00}">
     <apex:param value="{{!obj__c.re__c}" />
  </apex:outputText>
</td>

-Suresh

aballardaballard

What markup did you use to generate that?