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
Max_gMax_g 

I have a percent field on a custom object that I want to display as a whole number on my VF page.

Currently my percent is showing as a decimal value.  How do I convert to a whole number before displaying?

 

 

<

apex:outputtextstyle="float:right" value="{0,number, ,000}">

             

<apex:paramvalue="{!Sales_History__c.Jan_Margin_Pct__c} "/>

             

</apex:outputtext>

Best Answer chosen by Admin (Salesforce Developers) 
Max_gMax_g

Went back to my original code with the following modification and it produces the results I am looking for.

 

<

apex:outputtextstyle="float:right" value="{0,number,0.00}">

             

<apex:paramvalue="{!Sales_History__c.Jan_Margin_Pct__c}"/>

             

</apex:outputtext>

All Answers

AdrianCCAdrianCC

Hi Max!

 

Use either value="{!0, number, integer}" with the param value as you are doing now, OR just force the percent to integer with a formula like value="{!FLOOR(sales_field)}".

 

http://docs.oracle.com/javase/1.4.2/docs/api/java/text/MessageFormat.html

 

Thanks,

Adrian

Max_gMax_g

Tried both methods. 

Shows percent now, but is showing as 3457 percent instead of 34.57 percent.

 

Here is the code.

<

apex:outputtextstyle="float:right" value="{0,number,percent}">

             

<apex:paramvalue="{!Sales_History__c.Jan_Margin_Pct__c}"/>

             

</apex:outputtext>

Max_gMax_g

Went back to my original code with the following modification and it produces the results I am looking for.

 

<

apex:outputtextstyle="float:right" value="{0,number,0.00}">

             

<apex:paramvalue="{!Sales_History__c.Jan_Margin_Pct__c}"/>

             

</apex:outputtext>

This was selected as the best answer