• SoumyaChakraborty
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi, 

I am trying to display a summary table using apex:repeat. However, I am not getting the query right. Any help is appreciated. Below is my code.

Object: Time_Table__c  
Fields:  Class__c  --- lookup
             Time__c   --- lookup
             Day__c    --- picklist
             faculty_name__c  --- lookup
 
VF Page:
<apex:page controller="facultydetails_con" sidebar="false" >
<apex:form >
<center>
 <br></br><br></br>
  <b>Select Faculty </b>
  <apex:inputfield value="{!faculty.Faculty_Name__c}"/><br></br><br></br>
  <apex:commandButton value="Submit" action="{!submit}"/>  
  <apex:pageBlock >
   <apex:pageblockSection >
    <apex:repeat value="{!fd}" var="item">
     <apex:outputText value="{!item.Class__c}" />
    </apex:repeat>
   </apex:pageblockSection>
  </apex:pageBlock>
</center> 
</apex:form> 
</apex:page>

Controller:
 
public class facultydetails_con {

   public time_table__c faculty {get; set;}
   public list<time_table__c> fd {get; set;}
   
   public facultydetails_con()
   {
     list<time_table__c> fd = new list<time_table__c>();
   }
   public pagereference submit()
   {
    fd = [select class__c, day__c, faculty_name__c from time_table__c where faculty_name__c = :faculty.faculty_name__c];
    return null;
   }
}

Thank you,
Satya