I have a custom object which requires booleon values which are attached to contacts like the following:
Contact Option1 Option2 Option3
============================================
Bob true true false
Dave false true false
Sally false false false
I need to display these results in a table and then also display the total for each option at the bottom.
How can I achieve this? here is what I have so far...
APEX:
public with sharing class bbeventlist {
public list<RSVPData__c> lstItem {get;set;}
public list<RSVPData__c> getRSVPData(){
lstItem = new list<RSVPData__c>();
String query = 'SELECT Id, Name, Option1, Option2, Option3 FROM RSVPData__c ORDER BY CreatedDate DESC';
lstItem = Database.query(query);
return lstItem;
}
}
Page:
<apex:page id="optionsList" showHeader="true" title="Options Lits" controller="bbeventlist">
<apex:define name="body">
<h1>Options List</h1>
<apex:form >
<apex:pageBlock title="Attendees" mode="detail">
<apex:pageBlockButtons >
</apex:pageBlockButtons>
<apex:pageBlockTable value="{!RSVPData}" var="rsvp">
<apex:column value="{!rsvp.ContactID__c}"/>
<apex:column value="{!rsvp.Option1__c}"/>
<apex:column value="{!rsvp.Option2__c}"/>
<apex:column value="{!rsvp.Option3__c}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:define>
</apex:page>
Desired output:
Contact Option1 Option2 Option3
============================================
Bob true true false
Dave false true false
Sally false false false
--------------------------------------------
Total 1 2 0