+ Start a Discussion

Development required to pull report results in to a custom table in a VF Page?

If you have seen any of my other posts here, I am brand new to VF and totally inexperienced in APEX.


My task is to create a table on a VF page inside a Custom Object that is related to Accounts, that returns results from another related object to Accounts, called Sales Invoices.


So my table is 4 columns wide and 14 rows deep. The first three columns are the name of the month, and the 4th is the Quarter for those three months. The first row under the month returns a quantity, and the second is a dollar amount. Then the next three rows are for the 2nd quarter, 3rd quarter, 4th quarter, and last has quantity and dollar amount that returns the sum of the 4 quarters.


So, as an inexperienced developer with no budget for paying a developer, I would create 2 custom fields for each month, 2 custom fields for each quarter, and 2 custom fields for the yearly totals, and use the app Roll-up Helper to return values from the Sales Invoices in these fields on the Account record (and then reference the field on the Custom object in the VF page)... but that is 34 fields!


Let's see if I can clarify this a little better:

Row 1, column 1= January (just the word)

Row 2, column 2 = TOTAL quantity of all sales Invoices in January for that account

row 3, column 3 = TOTAL dollar amount of all sales invoices in January for that account


Row 1, column 2 = Feb... etc...


row 1 column 4 = Q1

Row 2 column 4 = quantity sum of column 1, column 2, and column 3

row 3 column 4 = dollar sum of column 1, column 2, and column 3



Row 4 colum 1 = April... etc.


Row 13, column 4 = TOTAL quantity of q1, q2, q3, q4

Row 14, column 4 - TOTAL dollar amount of q1, q2, q3, q4



So, what kind of development is involved to return essentally a custom report for that account, but in my VF and my own table?

Hi Jess,

I read through your requirement and I think this should be possible through visualforce using Datatable: http://developer.force.com/cookbook/recipe/building-a-table-of-data-in-a-visualforce-page

This doc has some code sample which will help you understand how you can get data from Objects to the visualforce in datatable cells - next you need to write methods with which you can calculate the aggregate/sum and display in the datatable cells.

read more: http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_std.htm

Hope this can help you start with the code.