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
Priyanshi AggarwalPriyanshi Aggarwal 

Adding List elements to a variable

Hi All,
I have a List<ART_Case__c> where ART_Case is a custom Object which has a field First_Response_Time__c having data type Number which Stores Average Response Time for Cases.Now I am Encountrig problem in a piece of code.
a=[Select First_Response_Time__c from ART_Case__c where Queue_Name__c=:ownerMap.get(c.OwnerId) and Created_Date__c=: date.Today() ];
       
       Float j=0.00;
       for(Integer i=0;i<z;i++)
       {
           j=j+a[i];
       }

The problem is with the data typeof variable j.Error: Compile Error: Invalid type: Float at line 77 column 8.Please Suggest me which Data Type I Should Use
Thanks in Advance
Best Answer chosen by Priyanshi Aggarwal
Suraj GharatSuraj Gharat

Priyanshi you may try "Decimal" instead of float.

All Answers

Suraj GharatSuraj Gharat

Priyanshi you may try "Decimal" instead of float.
This was selected as the best answer
Priyanshi AggarwalPriyanshi Aggarwal
Thanks Suraj. It worked now.