Explore Courses Blog Tutorials Interview Questions
0 votes
in Salesforce by (11.9k points)

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}" />         

No of connections has to be shown as whole number.

1 Answer

0 votes
by (32.1k points)
edited by

You can utilize parametrized output with formatting, for example:

<apex:outputText id="Connections" value="{0, number, integer}">

    <apex:param value="{!Event__c.Total_Connections__c}" />


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

Enroll in our Salesforce training to become as an expert in Salesforce!

Browse Categories