I have a custom object called Technology__c
and join object called AccountTechnologies
which is a join object between Account and Technology__c .So AccountTechnologies has a master detail relationship from both sides.
I have added a count__c
roll-up summary field in the Technology__c
to get the count But when i access it in the visual force page I get the following error
System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Technology__c.count__c
The following is the visualforce page code
<apex:pageBlockTable title="Technologies" value="{!AllTechnologies}"
var="t">
<apex:column value="{!t.Name}" headerValue="Technologies" />
<apex:column value="{!t.count__c}" headerValue="Count" width="20%">
</apex:column>
</apex:pageBlockTable>
You'll need to add the Count__c
field to your query in your custom controller.
-- Edit --
If you're querying off of Technologies, the query would look like this:
[Select Id, Name, Count__c From Technology__c];
If you're querying off of a junction object, you would need to query the relationship using a subquery. You can check the Technology or AccountTechnologies object definition (App Setup > Create > Objects) and click the Master-Detail field to find the Child Relationship Name. Add an __r
to that relationship name to find what object to subquery from.
To get the Technology__r
values into another object you would use the getSObjects()
method on the Account. This documentation has a great example at the bottom.
Also, check the custom controller documentation for more information.