Find your content:

Search form

You are here

Display number output field as whole number

 
Share

I have a custom field who's type is number, with format: 18 digit, 0 decimal places. However, when I output it using <apex:outputfield value="soBject__c.Number__c" /> for example, it displays: 18.0 dispite the fact that it's 0 decimal places in the number?

Is there anyway to hide the .0 ? Or do I just need to convert it to a string?


Attribution to: jordan.baucke

Possible Suggestion/Solution #1

would formatting do the trick?

   <apex:outputText value="{0,number,#,##0}">$    
       <apex:param value="{!soBject__c.Number__c}"/>
    </apex:outputText>

Attribution to: ebt

Possible Suggestion/Solution #2

I've found that by far the easiest/simplest way to achieve this is to just use the FLOOR() Visualforce function:

<apex:outputText value="{!FLOOR(sObject.Number__c)}"/>

Attribution to: Matt Lacey
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/1369

My Block Status

My Block Content