function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
BrettGusBrettGus 

Displaying reference info in a datatable?

I'm making a custom sales forecasting object.  I have a visualforce page that lets the salesperson enter their forecast for each month throughtout the year... with each row being a forecast for a seperate customer.   I'm then upserting these records via DML.  What I'd like to be able to do is display the previous years forecast for that salesperson inline next to the forecast they are entering.  Do I have to create these fields in my custom object (even though I wont be saving this info) in order to display it in this datatable?

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

You can use a wrapper class to encapsulate the data for each row.  In this case that would be the custom object that they are editing, along with the information on the previous year.  

 

In the visualforce page, you'd then back your datatable with a list of wrapper classes (rather than a list of the custom object), and rather than dealing with the custom object's fields directly, you'd need to follow the getter from the wrapper class to the custom object.