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
Vishal_ThoriyaVishal_Thoriya 

How to get values of digit after decimal point notation ?

Hi,

 

I am having decimal number like this : 4.77080

 

but i want only 77 after decimal point notation.

 

How can i achieve this?

 

Any kind of help will be greatly appriciated.

 

Thanks in advance..

 

Vishal.

 

Best Answer chosen by Admin (Salesforce Developers) 
Navatar_DbSupNavatar_DbSup

Hi,

 

you can use setScale method in Apex class

 

For Eample

 

decimal aa=43.3432332343344;

aa= aa.setScale(2);

 

system.debug('@@@@@'+aa);

All Answers

Navatar_DbSupNavatar_DbSup

Hi,

 

You can use the below code snippet as reference

 


--------- VF page--------------

<apex:page controller="clsdipslayformat" >
   <apex:outputText value="{0, number, ###,###,##0.00}">
         <apex:param value="{!aa}" />
</apex:outputText>
</apex:page>

---------Apex Controller ----------------

public class clsdipslayformat 
{
public double aa{get;set;}
public clsdipslayformat ()
{
    aa=43.34324334232432;
}


}

 

 

question? If not, let me know what didn't work, or if so, please mark it solved.  

Vishal_ThoriyaVishal_Thoriya

Thanks for the help buddy,

 

but i want to achieve it on controller side (Apex Class)  not on visualforce page.

 

is there any way to do so ?

 

Thanks,

Vishal.

Navatar_DbSupNavatar_DbSup

Hi,

 

you can use setScale method in Apex class

 

For Eample

 

decimal aa=43.3432332343344;

aa= aa.setScale(2);

 

system.debug('@@@@@'+aa);

This was selected as the best answer
RonakPatel.ceRonakPatel.ce

@ Vishal

 

Khotu

 

tamaro javab perfect na kehvay

 

Tame jao Bahar....