+ Start a Discussion

conversion of list of type object to integer

How to convert a list of custom object type to integer data type? Is there any type casting in apex to do it? Anyone please suggest

You can't just convert a custom object to an integer.  A custom object is a collection of fields.  An integer is a number.


If your custom object has an number-typed field that you'd like to use in a list of integers, then you can just make a List<Integer>, iterate through your list of custom objects, and call add() on your List<Integer> for each value of that number-typed field in the custom object.


I have taken all the integer values into a custom object type list variable and assigned each of it to an integer variable by using .column name format.


Example: Integer i = values[0].Base_Price__c


Its working...