Displaying Related Records In A Group Wise

<apex:page controller="groupwisedisplay" sidebar="false" title="Displaying Related Records In A Group Wise" showHeader="false">
 <!-- Begin Default Content REMOVE THIS -->
 <h1> Displaying Related Records In A Group Wise </h1>
 <br>===================================</br>
 <apex:repeat value="{!StartHere}" var="gp">
   <li>
 <strong>
 <apex:outputText style="color:blue;" value="{!gp.acc.Name}"/>
 </strong>
    <ul>
     <apex:repeat value="{!gp.con}" var="p">
      <li> (Contact) &nbsp;
       <apex:outputText style="color:green" value="{!p.FirstName}"/> &nbsp;
       <apex:outputText style="color:green;" value="{!p.LastName}"/>
    <ul >
     <li ><ol>
      (Case)<apex:repeat value="{!p.Cases}" var="child">
     <li >
      <apex:outputText style="color:gray;" value="{!child.Subject}"/>
     </li>
     </apex:repeat>
    </ol></li>
 </ul>
 </li>
 <br></br>
 </apex:repeat>
 </ul>
 <ul>
 <apex:repeat value="{!gp.opp}" var="p">
 <li> (Opportunity) &nbsp;
 <apex:outputText style="color:red" value="{!p.Name}"/>
 <ul>
 <apex:outputLabel value="Close Date:" for="out1"/>
 <apex:outputText value="{!p.CloseDate}" id="out1"/> <br>
 <apex:outputLabel value="Stage:" for="out2"/>
 <apex:outputText value="{!p.StageName}" id="out2"/></br>
 </ul>
 </li>
     <br></br>
     </apex:repeat>
    </ul>
   </li>
 </apex:repeat>
 </apex:page>

 

Apex Code/ Controller

public class groupwisedisplay {

public list<wrapgroupwise> singlegroup;
public List<wrapgroupwise> getStartHere(){
singlegroup= new List<wrapgroupwise>();
List<Account> tempacc=[select Id, Name from Account Limit 10];

for(Integer i=0; i<tempacc.size() ; i++){
list <contact> tempcon=[SELECT Id, FirstName, LastName,(SELECT Id, CaseNumber,Subject From Cases) From Contact Where AccountId =:tempacc[i].id Limit 10];
list <Opportunity> tempopp=[SELECT Id,Name,CloseDate,StageName From Opportunity Where AccountId =:tempacc[i].id Limit 10];
singlegroup.add( new wrapgroupwise(tempacc[i],tempcon,tempopp));

}
return singlegroup ;

}
 //wrapper class
 public class wrapgroupwise{
 public List<contact> con {get;set;}
 public Account acc {get;set;}
 public List<Opportunity> opp {get;set;}

 public wrapgroupwise( Account a , list<Contact> c,list<Opportunity> o){
 acc=a;
 con=c;
 opp=o;
 } //end of wrapper class
 }
}

group wise displaying records

Advertisements

3 thoughts on “Displaying Related Records In A Group Wise

  1. I have tried after moving to c:\eclipse\ still while installing force.com plugging, I’m getting the following error
    Cannot complete the install because one or more required items could not be found.
    Software being installed: Force.com IDE 25.0.0.201206181021 (com.salesforce.ide.feature.feature.group 25.0.0.201206181021)
    Missing requirement: Force.com IDE 25.0.0.201206181021 (com.salesforce.ide.feature.feature.group 25.0.0.201206181021) requires ‘org.eclipse.update.ui 0.0.0’ but it could not be found

    Hay can you plz help me out.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s