+ Start a Discussion
The new LearnerThe new Learner 

how to find the decimal places --urgent

I have two fields called Week and Frequency of deciaml with place 0, now my requirment is if  Week/Frequency out put with decimal zero then it need to allow in the loop. Excpet Zero(eg:1.0,2.0,3.0) in the deciamal place it should not allow any value (eg:1.1,2.1,3.1) .

 Week=42.0, freuency=6.0 
currentweek=7.0 then i need to make checkbox true 
if currentweek value is 7.1 then i need to make that checkbox false
v varaprasadv varaprasad
Hi ,

Please check once below sample code : 
Decimal weekDecimal=42.0;
integer week = weekDecimal.intValue();

Decimal myfreuency=6.0;
integer freuency = myfreuency.intValue();

integer remainder = math.mod(week, freuency);

if(remainder == 0){
    system.debug('DO your logic');

Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.

@For Salesforce Project Support: varaprasad4sfdc@gmail.com

Salesforce latest interview questions  :

Amine Mastour 3Amine Mastour 3

Hope this sample code helps you:
Decimal week = 10.0;
Decimal freuency = 5.0;
Decimal currentWeek = week/freuency;
Integer intCurrentWeek = Integer.valueOf(currentWeek);
Boolean result = (currentWeek - intCurrentWeek == 0) ? true : false;