You need to sign in to do that
Don't have an account?

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>
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
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
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>
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>