Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do format output text to show only whole numbers and not decimals along with it in Vf page

I want to display a field in a object to show just the whole number/integer value. This field has decimal values in the structure but for i need to show the integer value for this VF page only.

 <apex:pageBlockSectionItem >
                    <apex:outputLabel value="# Connections" for="Connections"/>
                    <apex:outputText id="Connections" value="{!Event__c.Total_Connections__c}" />         
                </apex:pageBlockSectionItem>

No of connections has to be shown as whole number.

thanks

like image 787
Prady Avatar asked Feb 11 '12 07:02

Prady


1 Answers

You can use parametrized output with formating, for example:

<apex:outputText id="Connections" value="{0, number, integer}">
    <apex:param value="{!Event__c.Total_Connections__c}" />
</apex:outputText>

For more detail about all the formating options, check Java's MessageFormat, the same formating is used for <apex:outputText>

like image 105
mmix Avatar answered Nov 19 '22 02:11

mmix