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

Illegal assignment from Double to Integer?????

Hi Happy Holidays...
I have a number(5,2) field and when I try to update it through apex code I get the following statement

Error: Compile Error: Illegal assignment from Double to Integer

I have it written like so:
Integer intg=pos.Days_Pend;


Does anyone know how to fix this??
I am using the 'intvalue' as shown below to assign a double to an integer variable...
Double mthsD = newSiteLeaseCumCost[i].Lease_Term_In_Months__c;
Double escmthD = newSiteLeaseCumCost[i].Escalation_Month__c;
Integer mths = mthsD.intValue();
Integer escmth = escmthD.intValue();

Is that what you are interested in?
Number values, regardless of what they are through the interface, are always saved as doubles on the backend.  So even if you create a number value with 0 precision, its still represented as a double variable within that object's properties.
ram tungalaram tungala
i have written this in apex class 

public void cube()
    system.debug('the value of cube is----'+res2);

but the error :Illegal assignment from Double to Integer