You need to sign in to do that
Don't have an account?

how to convert aggregate field value to integer
hi all this is the query i used in the trigger and i want ot convert the lstar aggregate value in to integer value plz help how to do that
lstAR = [select Sum(Quantity_remaining__c)am from Inventory_Transaction__c where item__c=:ifl.item__c and warehouse__c=:ifl.warehouse__c ];
hi i want the am value into a integer variable and also this is a trhgger so tell me the code part in view of a trigger
You have to change the interger to double if sum contains the large value.
Double intdata =(Double)lstAR[0].get('am');
system.debug( 'Integer value ' + intdata );
All Answers
Hi,
you can use below code to work around on Aggregate result data.
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
hi navatar this is the error i am getting while saving the record
System.TypeException: Invalid conversion from runtime type Double to Integer: Trigger.createinventorytransaction: line 13, column 18
this is the changed trigger after using ur code
You have to change the interger to double if sum contains the large value.
Double intdata =(Double)lstAR[0].get('am');
system.debug( 'Integer value ' + intdata );
thats a great help navatar dp sup