You need to sign in to do that
Don't have an account?
How to Removing Trailing Zeros in outputField
I am trying to round the decimal places that are being displayed in an outputField to remove trailing zeros. The custom field that I am trying to display is set to be a number with 7 decimal places. There are cases though where not all 7 decimal places will be used, so I want to strip away trailing zeros.
Example: If I had 10.0001000 I want it to display as 10.0001 on my Visualforce page.
I tried doing something like this:
<apex:outputField value="{0}"> <apex:param value="{!ROUND(customField__c, number)}" /> </apex:outputField>
This returned an error value for <apex:outputField> is not a dynamic binding!
If I change it to an outputText it works, but I need this field to be based on user locale which is why I was using an outputField.
Thanks in advance!
HI
Try this .
<apex:outputText value="{0, number, ###,###,###,##0.00}"> <apex:param value="{!a.customField__c}"/>
</apex:outputText>
Let me know if any issues.
Thanks I ended up using something like this to format my field based on the user locale because the outputText rounds of trailing zeros.
I tried to do something similar to this for the inputText field
but I get a syntax error.
Is it possible to format data inside of an inputText field?
Thanks!
<apex:outputText value="{!SUBSTITUTE(TEXT(additionalCost.List_Price__c)+'0','.',',')}"
Here removed trailing zeroes automatically, when converted to text.
Can i maintain it within the page itself??