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
Mano sfdcMano sfdc 

Wrapper Class not showing records

Hi Experts,

Please find below Class & Page. It is not showing output values.

Apex Class:

public class RetrieveClassesTriggersInWrapper{

   public List<ApexClass> classNames{set;get;}
   public List<ApexTrigger> triggerNames{set;get;}
   public List<ApexClass> testClassNames{set;get;}
   public List<Apexpage> pageNames{set;get;}
   public List<MyWrapper> wrapper {get; set;}


   public void RetrieveClassesTriggersInWrapper()
   {
     classNames=[SELECT id, name from ApexClass where not(Name like '%test%') ORDER BY Name ASC];
     triggerNames=[SELECT id, name from ApexTrigger ORDER BY Name ASC];
     testClassNames=[SELECT id, name from ApexClass where (Name like '%test%') ORDER BY Name ASC];
     pageNames=[SELECT id, name from Apexpage ORDER BY Name ASC];
     
     wrapper = new List<MyWrapper>() ;
 
     for(Integer i=0 ; i < 10 ; i++)
     wrapper.add(new MyWrapper(classNames[i], triggerNames[i], testClassNames[i], pageNames[i])) ;

   }

   public class MyWrapper
   {
     public ApexClass Classes {get; set;}
     public ApexTrigger Triger {get; set;}
     public ApexClass testClass {get; set;}
     public Apexpage vfPage {get; set;}

       
     public MyWrapper(ApexClass cls, ApexTrigger tri, ApexClass testCls, Apexpage page)
     {
        Classes = cls ;
        Triger = tri ;
        testClass = testCls;
        vfPage = page;
     }
  }
}


VF Page:

<apex:page controller="RetrieveClassesTriggersInWrapper">
  <apex:pageBlock >
   <apex:pageblockSection >
     <apex:pageBlockTable value="{!wrapper}" var="wrap">
       <apex:column headerValue="Classes" value="{!wrap.Classes.Name}"/>
       <apex:column headerValue="Triggers" value="{!wrap.Triger.Name}"/>
       <apex:column headerValue="TestClasses" value="{!wrap.testClass.Name}"/>
       <apex:column headerValue="Visualforce Pages" value="{!wrap.vfPage.Name}"/>
     </apex:pageblockTable>
   </apex:pageblockSection>
  </apex:pageBlock>
</apex:page>

Out put:  Output not showing any values.

Output


Please anyone help me.

Thanks,
Manu
reymagdaongreymagdaong
Hi,

   public void RetrieveClassesTriggersInWrapper()
   {

this line i assume this is the constructor? please try to remove the void return type. this should look this.
   public RetrieveClassesTriggersInWrapper()
   {

thanks
 
Rupal KumarRupal Kumar
hi Manohar,
     The syntax for a constructor is similar to a method, but it differs from a method definition in that it never has an explicit return type and it is           not inherited by the object created from it.
         public void RetrieveClassesTriggersInWrapper()
     
        Remove void return type- public RetrieveClassesTriggersInWrapper() 

Thanks
Rupal Kumar
Mirketa Software Pvt Ltd
http://mirketa.com/index.html