
Apexcode:
public List<String> ShowSuggestions = new List<String>();
public List<String> getSuggestions() {
ShowSuggestions = [select Abholort__c, COUNT(Name) from Fahrzeuge__c
GROUP BY Abholort__c ];
return ShowSuggestions;
}
VF page
<apex:pageBlockTable value="{!Suggestions}" var="showsugg" >
<apex:column value="{!showsugg.COUNT(Name)}" />
<apex:column value="{!showsugg.Abholort__c}" />
</apex:pageBlockTable>
I am getting an error of Illegal assignment from list to list. Can anybody let me know where am I wrong.
Thanks.1 resposta
Hi Shravya,You are using aggregate query. Please change ShowSuggestions type to AggregateResult as shown below.List<AggregateResult> ShowSuggestions =new List<AggregateResult>();Please find the more info about aggregated function.https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_SOQL_agg_fns.htmkindly mark it as an answer if that resolves your query.