I have a custom object as opportunity forecast , which is not related to Quote object,but i would like to create a visual force page on Quote object ,by calling the custom object fields (like partnos,quantity,price,)in a pivot table (Repeat for all periods (Month- year) This should be pivot as the data stored for every period in the opportunity forecast custom object).how to Achieve this?

2 Answers 2


First: if you can use Reports, please prefer them over coding anything from scratch.

If you still want/need something custom:

In the end pivoting ends up in the S(O)QL statement GROUP BY and for sure you can use this in Apex. To display the results you can create either your own HTML markup in Visualforce or you search for a Javascript component.

Depending on you data volume, you could also query all (or a lot of) data and do the (or some) pivoting client-side with Javascript.

A very quick search shows you some candidates for further investigation:


I didn't use any of them, so I can't provide you a recommendation.


You may want to have a look at using a Matrix report type from the Report Builder... I don't think there's anything out of the box to allow for a pivot table in VF without manually coding it. Here's a link with info on creating matrix reports: http://www.salesforce.com/_app/video/chatter/help/matrix_reports.jsp.

You must log in to answer this question.

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