You need to sign in to do that
Don't have an account?
Charms Mob
When to Use List
Hi Developer,
I have written a sample piece of code .Here it is
Public class TotalPrice_cls{
public static void calTotal(Book__c[] b)
{
for(Book__c[] s: b)
s.Total_Price__c = s.Price__c* s.Quantity__c;
}
}
While running the code it displays the error message as :Error: Initial term of field expression must be a concrete SObject: LIST<Book__c> at line 9 column 1.
May i know the reason for this error message. Thanks in advance.
I have written a sample piece of code .Here it is
Public class TotalPrice_cls{
public static void calTotal(Book__c[] b)
{
for(Book__c[] s: b)
s.Total_Price__c = s.Price__c* s.Quantity__c;
}
}
While running the code it displays the error message as :Error: Initial term of field expression must be a concrete SObject: LIST<Book__c> at line 9 column 1.
May i know the reason for this error message. Thanks in advance.
change For(Book__c[]s:b) to for(Book__c s : b);
The reason here is using for loop your sending one record at a time not an array of record. If its an array/collection go with list.