Skip to main content

Posts

Showing posts with the label how to format number in Visaulforce or LWC? how to show percentage in LWC component

How to format number in Visualforce and in LWC ?

 Use Case - We want to show a number in percentage format, say if field value contains 15 then we need to show in UI as like 15%. Here is the sample code for it. <apex:outputLabel value="In-Network Copay Amount:" for="incper" style="color:#3E3E3C" >         <apex:outputText value="{0, number, ###,##0}" id="myNumberDisplay" > <apex:param value="{!Eligibility_Summary__c.In_Network_Copay_Percentage__c}"/> </apex:outputText>%  </apex:outputLabel>   LWC < div   class = "slds-col slds-size_1-of-2" >     < label > In-Network Copay Amount </ label >     < div   class = "slds-col slds-size_1-of-1" > < lightning-formatted-number   value = { summary . In_Network_Copay_Percentage__c } > </ lightning-formatted-number >      %     </ div > </ div >