+ Start a Discussion

Addition of values in visualforce page level



i am facing trouble while i want to add the values of displayed items .

For example :



1                2                         3  == 6


2                 3                        1 == 6


3                 1                         2  == 6



6                6                          6



I am using group by clause for getting values.


my query :


Select Count(CaseNumber) tot1 , Product_Service_Category_Poc__c p1,Case_Type_Poc__c p2  from  Case where CreatedDate = THIS_WEEK and Status = 'open' group by Product_Service_Category_Poc__c,Case_Type_Poc__c


You want to sum the rows and the columns from the group by query?


You would have to do that in Apex Code.


i want to sum the rows & columns values in vf page level..


1) For the rows, you could use an expression like {!object.field1 + object.fiel2}.

2) For the columns, Apex would work.  Just do the calculation and return the value to the VF page.  That is the best MVC way to do it.


In general, it is not a good idea to do calculations in the VF page.  Apex has the tools to do it right.



if rows r coloumns increases means is that code work


my actual requirement is same as GROUP BY CUBE.





i am trying to optimize this code 


I think I need more information to help - some code sample that isn't working, screenshot, etc.?  I'm not understanding what the problem is.


I am unable to write code for GROUPBY CUBE both Apex Classes , Visualforce Page.


Can i give Team Viewer  to u so that i can show to u.



Tech EnthuTech Enthu

Dear Raja Sekhara:

Did you ever find a solution for this issue? I would like to calculate the row and column summaries dynamically and display them on theVF page immediately. These summary values should be generated dynamically when user add a row or delete a row or changes any cell value.