+ Start a Discussion
udayar_jayamudayar_jayam 

How to calculate the row values in apex:repeat

 Hi All


 

I have a VF Page which displays the values from different object as a table. I need to perform the row based calculation in that table. Please find below the example and help me out in solving this

 

Rl R2 Total  Total(%)
A  25 25 50

B  50 75 125
robdobbyrobdobby
There are several ways to handle this.  You could do this in the client using JavaScript, or in the controller.  I'm guessing your VF is something like this, or maybe you're using a pageBlockTable, either way:

<table>
<tr>
<th>R1</th>
<th>R2</th>
<th>Total</th>
<th>Total(%)</th>
</tr>
<apex:repeat value="{!objects}" var="nextObject">
<tr>
<td>{!nextObject.R1__c}</td>
<td>{!nextObject.R2__c}</td>
<td>{!nextObject.Total__c}</td>
<td></td>
</tr>
</apex:repeat>
</table>

Are you trying to calculate the Total(%)?