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
Ali AbdullatifAli Abdullatif 

Showing an Aggregated query in Visual force table doesn't work PLEASE HELP

I have this class that only does this query 
public with sharing class Contracts_Statistics_Page_Controller {
	public List<AggregateResult > allFTContacts { get; set; }
    public Contracts_Statistics_Page_Controller (){
    	 
    	allFTContacts = [select count(id), Domestic_Helper__r.Current_Status111__c, Full_Time_Client__r.Status__c, Cancelled_contract__c 
    						from Contract_Full_Time__c where End_of_Contract__c>YESTERDAY 
    						group by Domestic_Helper__r.Current_Status111__c, Full_Time_Client__r.Status__c, Cancelled_contract__c]; 
    }
}

and I want to show it in this page
<apex:page controller="Contracts_Statistics_Page_Controller" showHeader="false">
<apex:define name="body">  
	<apex:form id="mainForm">       
		<apex:pageBlock id="myPageBlock" title="Contracts Statistics">                
	    	<apex:pageBlockTable id="myPageBlockTable" value="{!allFTContacts}" var="item" styleClass="maintable">
	            <apex:column headerValue="Domestic Helper status" value="{!item.Domestic_Helper__r.Current_Status111__c}" />
	            <apex:column headerValue="Full Time Client status" value="{!item.Full_Time_Client__r.Status__c}" />
	            <apex:column headerValue="Cancelled Contract" value="{!item.Cancelled_contract__c}" />
	            <apex:column headerValue="Count" value="{!item.count(id)}" />                    
	             
	        </apex:pageBlockTable>
		</apex:pageBlock>
	</apex:form>
</apex:define>
</apex:page>

but the file doesn't save as it tells me 
Save error: Invalid field Domestic_Helper__r for SObject AggregateResult    ContractsStatisticsPage.page   
 
JeffreyStevensJeffreyStevens
Well - allFTContacts - is not a list of Contract_Full_Time__c objects.  It's a list of AggregrateResults.  Therefore - in your page - the type of your var - "item" - is not a Contract_Full_Time__c - it's a individual entry in the <AggregrateResult>.

So - I think you'll have to do a column like this (but I'm not sure).
<apex:column value="{!item.get('Domestic_Helper__r.Current_Status111__c')}" />