0

The aggregate for the field amount and JZ doesnt work.

CLASS

Public Class VTP2_class {

Public Summary[] Summaries {get; set;}

Public VTP2_class() {

AggregateResult[] results = [SELECT COUNT(Id) Anz, SUM(Amount) BWS, SUM(JZ__c) JZ, Account.OwnerId FROM Opportunity GROUP BY Account.OwnerId];
    Summaries = new List<Summary>();
    FOR(AggregateResult ar : results) {
        Summaries.add(new Summary(ar));
    }
}

public class summary {
    public Integer Anz {get; set;}
    public Double BWS {get; set;}    
    public Double JZ {get; set;}      
    public String OwnerId {get; set;}

public summary (AggregateResult ar) {
    Anz = (Integer) ar.get('Anzahl');
    BWS = (Double) ar.get('BWS');    
    JZ = (Double) ar.get('JZ');      
    OwnerId = (String) ar.get('OwnerId');
    }
}

}

PAGE

<apex:repeat value="{!Summaries}" var="summary">
    {!summary.OwnerId} : {!summary.Anzahl} : !{summary.BWS} : !{summary.JZ} <br/>
</apex:repeat>

The result at the visualforce show me the following:

005b0000001RmouAAC : 2 : !{summary.BWS} : !{summary.JZ}
005b0000001RmpNAAS : 1 : !{summary.BWS} : !{summary.JZ}
005b0000001RmooAAC : 1 : !{summary.BWS} : !{summary.JZ}

I don't know why the result shows the syntax from BWS and JZ and not the values.

1 Answer 1

3

you did a typo in VF page. !{summary.BWS} : !{summary.JZ}. exclamation mark !should be after brace {.

Correct way {!summary.BWS} : {!summary.JZ}


<apex:repeat value="{!Summaries}" var="summary">
    {!summary.OwnerId} : {!summary.Anzahl} : {!summary.BWS} : {!summary.JZ} <br/>
</apex:repeat>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .