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
Mathieu CanyMathieu Cany 

Display table and details group by ownerId

Hi,

 

Ive created a view like this one (http://imageshack.us/photo/my-images/51/vue1.png/).

As you can see I display all opportunity and there are group by Account Name (A bank In my case).

I'm using the following code for display these informations. (http://blog.sforce.com/sforce/2008/10/group-sum-and-o.html)

 

 

Now I would like to display all my opportunity grouped by another type, nor more related to Account. I would like to group them by Opportunity Owner.  The following sreenshot show that my code doesn't send any information. (http://imageshack.us/content_round.php?page=done&l=img824/1430/vue2m.png&via=mupload&newlp=1)

 

My controller :

 

 

            public class opportunityTotal {
         public Opportunity opportos { get; set; }
         public list <Opportunity> opporto { get; set; }
         public Opportunity total { get; private set; }
         public Opportunity totalparemploye { get; private set; }
         public Opportunity totalparemployepercue { get; private set; }
         public Opportunity account { get; private set; }
         public Opportunity orr { get; set; }
         
        
        
       public opportunityTotal(Opportunity orr) 
 {
    total = new Opportunity(Amount__c = 0);
    totalparemploye = new Opportunity(Commission_to_Sextant__c = 0);
    totalparemployepercue = new Opportunity(Commission_to_Sextant__c = 0); 
    if(orr.Amount__c != null){
    {
        totalparemploye.Commission_to_Sextant__c += orr.Commision_owner_1__c + orr.Amount_commision_2__c + orr.Commission_1_Bis__c;
    }
                              	     
    totalparemployepercue.Commission_to_Sextant__c += orr.Commission_owner_percue__c;
     }

     }
    } 
    
    
    
     public List<OpportunityTotal> getnouvellevueparemploye() {
        List<OpportunityTotal> nouvellevueparemploye = new List<OpportunityTotal>();
        for(Opportunity orr:[select name,Amount,Amount__c, OwnerId, Owner.FirstName, Owner.LastName, Classer_le_dossier_dans_les_historiques__c, LeadSource, Commission_to_Sextant__c, Commision_owner_1__c,	Completion_fees__c,
        							Commission_1_Bis__c, Commission_1_Bis_Paid__c, 	Commission_1_paid_to_owner__c, 	Payed__c, Commision_owner_2__c, Commision_Lead_source__c, 	Amount_charged__c, Amount_commision_2__c, Amount_commision_to_source__c, 	Fee_Paid__c, 	Completion_fee_paid__c,
        							Chiffre_d_affaire_du_dossier__c, CA_realise_du_dossier__c, 	Benefice_du_dossier__c, Befefice_du_dossier_realise__c, StageName, Commission_owner_percue__c
                from Opportunity
                ])  
                 {

        /*   --------1.11------------------------------- AJOUT DES RESULTATS SUR LA 2.00 ------------------1.11---------*/
            nouvellevueparemploye.add(new OpportunityTotal(orr));
        }
        
        /*   --------1.12------------------------------ RETOUR VERS LIST AVEC EN PARAMETRE LA REQUETE ------------------1.12---------*/
        return sortOpportunityTotals(nouvellevueparemploye);
    }
    
    
    
    
private List<OpportunityTotal> sortOpportunityTotals(List<OpportunityTotal> totals) {
        List<OpportunityTotal> returnList = new List<OpportunityTotal>();
        
    
        Map<Decimal, List<OpportunityTotal>> totalMap = new Map<Decimal, List<OpportunityTotal>>();
        
        for(OpportunityTotal t:totals) {
            if(totalMap.get(t.total.amount) == null) {
                totalMap.put(t.total.amount, new List<OpportunityTotal>());            
            }
            totalMap.get(t.total.amount).add(t);
        }

        List<Decimal> keys = new List<Decimal>(totalMap.keySet());
        keys.sort();

        /* Sort puts things in ascending order so for descending iterate over
           the keys backwards. */
        for(Integer i = (keys.size()-1);i >= 0; i--) {
            returnList.addAll(totalMap.get(keys.get(i)));
        }

        return returnList;
    }
           
           
    
    
    

 

 

My VF page

 

 

   
         <apex:pageBlockTable value="{!nouvellevueparemploye}" var="ar">
                <apex:column headerValue="Owner Name" value="{!ar.orr.OwnerId}"/>  
                <apex:column headerValue="Detail">
                <apex:pageBlockTable value="{!ar.orr}" var="o">
                    <apex:column value="{!o.name}"/>
                    <apex:column value="{!o.Fee_Paid__c}"/>
                    <apex:column value="{!o.Amount_charged__c}"/> 
           </apex:pageBlockTable>
            </apex:column>
 
        </apex:pageBlockTable>
        

If there is another way to display infomation that I would like, let me know :).

 

Thanks for your support.