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
karthic sankar 9karthic sankar 9 

Pls help Error: Invalid field Week__c for SObject AggregateResult

Hi Experts,

I am getting below error which i dont know how to solve.. Pls help.

Kindly help in resolving.

My controller

public class ViewQAAMController {

    public List<AggregateResult> BadgeList { get; set; }
   
    public List<AggregateResult> getBadgeList()
  {
          List<AggregateResult> badges = [select Week__c apple from QAAM_Weekly_Planner__c Max group by Week__c order by max(createddate) desc LIMIT 10];
          return badges;
  }
 
}

My VF page

<apex:page controller="ViewQAAMController">
<apex:form >
<apex:pageBlock >

<apex:pageBlockTable value="{!BadgeList}" var="data" >

    <apex:column value="{!data.Week__c}"/>

</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

Error: Invalid field Week__c for SObject AggregateResult

Pls help.

Regards
Karthic Sankar V P
Best Answer chosen by karthic sankar 9
Footprints on the MoonFootprints on the Moon
Hi Karthic,

Change your pageBlockTable code with below snippet-
<apex:pageBlockTable value="{!BadgeList}" var="data" >

    <apex:column>
		<apex:outputText>{!data['Week__c']}</apex:outputText>
	</apex:column>

</apex:pageBlockTable>

Let me know it this helps.

All Answers

Footprints on the MoonFootprints on the Moon
Hi Karthic,

Change your pageBlockTable code with below snippet-
<apex:pageBlockTable value="{!BadgeList}" var="data" >

    <apex:column>
		<apex:outputText>{!data['Week__c']}</apex:outputText>
	</apex:column>

</apex:pageBlockTable>

Let me know it this helps.
This was selected as the best answer
karthic sankar 9karthic sankar 9
Thank you Mate. @Footprints on the Monn