+ Start a Discussion

SUM data in a pageBlock table?

How can I SUM data returned in a pageBlock, or do I need to use another method to do so?  I am trying to create a Billing Report, returning Project data and N line items for Time & Expense, and I need to summarize the Time and Expense sections, then add those subtotals together.  

Any approach advice is appreciated as I am brand new to VisualForce.


Instead of page block you use the inner class in which each row will act as the object.Put this object in the loop and save  its value in list or Map.


Mohit Mohan

  Salesforce Developer Support



So you are telling me I need to create a custom class, and that there is no way in simple visualforce to SUM records?


Is there any way I can create a formula field that does: SUM(Projects__c.Time_Sheets__r.Total_Line_Amount__c)  ?