• Naďa Bokova
  • NEWBIE
  • 0 Points
  • Member since 2015
  • IBM


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

Well, I was finally able to get one of my related lists (Cases), which is part of a custom object (X360_Contract_Cycle__c), to display properly.  I am using apex:repeat to iterate and display the related list information.  So far that is working great!  Now I am trying to figure out the best solution to SUM on of the values within the related list/apex:repeat.  The value I am trying to SUM is {!cx.Case_Hours__c}.  I included a snippet of the code below.  I am wondering if I can include the logic directly on the VisualForce page or would I need to create a custom Apex class?  Any suggestions would be much appreciated as I am still learning.  Thanks! 

 

 

<apex:page standardController="X360_Contract_Cycle__c"    showHeader="false"  renderAs="pdf">
.
.
.
                
                <tr>
                    <td>Case Number</td>
                    <td>Case Subject</td>
                    <td>Case Hours</td>
                </tr>
                
                <apex:repeat var="cx" value="{!X360_Contract_Cycle__c.Cases__r}">

                    <tr>
                        <td>{!cx.CaseNumber}</td>
                        <td>{!cx.Subject}</td>
                        <td>{!cx.Case_Hours__c}</td>
                        
                        <apex:variable var="Total" value="{SUM(!cx.Case_Hours__c}"/>
                        
                        <td>{!Total}</td>
                        
                    </tr>
                
                 </apex:repeat>
 
</apex:page>