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
practice projectpractice project 

Not able to fetch records from controller in table please anyone help

apex class
////////////////////////////////////////////////
public list<DRMI_Enrollment__c> activeEnrollments{get;set;} public list<DRMI_Enrollment__c> CurrentsEnrollments{get;set;} public void DrmiCbprPortal() { activeEnrollments = new list<DRMI_Enrollment__c>(); List<DRMI_Enrollment__c> activeEnrollments = [select ProgramId_EI__r.Program_Code__c,Status_EI__c,id,AggregateId__c,City_EI__c,SA_ID_EI__c from DRMI_Enrollment__c where ProgramId_EI__r.Program_Code__c='CBP' and Status_EI__c='2' limit 5]; System.debug('activeEnrollments'+activeEnrollments); } Public list<DRMI_Enrollment__c> getShowList(){ System.debug('@@activeEnrollments'+activeEnrollments); return activeEnrollments;
visualforce page
/////////////////////////////////////////////////

</div> <table class="table table-striped"> <thead> <tr> <th>Name</th> <th>PGE service agreement number</th> <th>Electric meter number</th> <th>Service address and city</th> </tr> </thead> <tbody> <apex:repeat value="{!activeEnrollments}" var="record"> <tr> <td> <apex:outputtext value="{!record.Name }" /> </td> <td> <apex:outputtext value="{!record.ProgramId_EI__r.Program_Code__c }" /> </td> <td> <apex:outputtext value="{!record.Status_EI__c }" /> </td> </tr> </apex:repeat> </tbody> </table>
Ankit RathorAnkit Rathor
Hi ,

Please try this code:

Apex class

public list<DRMI_Enrollment__c> activeEnrollments{get;set;} 
public list<DRMI_Enrollment__c> CurrentsEnrollments{get;set;} 
public DrmiCbprPortal() { 
    activeEnrollments = new list<DRMI_Enrollment__c>(); 
    activeEnrollments = [select ProgramId_EI__r.Program_Code__c,Status_EI__c,id,AggregateId__c,City_EI__c,SA_ID_EI__c from DRMI_Enrollment__c where ProgramId_EI__r.Program_Code__c='CBP' and Status_EI__c='2' limit 5]; 
    System.debug('activeEnrollments'+activeEnrollments); 

Public list<DRMI_Enrollment__c> getShowList(){ 
    System.debug('@@activeEnrollments'+activeEnrollments); 
    return activeEnrollments;

}

I hope it helps you.

Please let me know if you have any other query. If this solution is helpful then please mark it as Best Answer.

Thanks,
Ankit Rathor