0

So I have a monthly payment $ value pulled from a field "payment__c" and its increases by 10% for every month for 12 months. i want to pull this in the child object and display that using a table in VF page. Such as

Month    Amount

Jan      $100 
Feb      $110 (increases by 10% every row)
March    $121

I am not able to find the code to just build a simple html table without data unless you have records you want to display. I assumed there was a FOR LOOP type option. I need to get started all examples seem to have a controller while I think since I am multiplying a single value it should be simpler.

Appreciate your help !

  • Hi @CalSFDC, welcome to SFSE! Please take some time to visit How to Ask and take the tour. Afterwards, please update your psot with what you have tried, and any code sample you might have so others can assist you. – glls May 17 '17 at 20:29
  • updated my description with the request – CalSFDC May 17 '17 at 21:09
0

You will need to use a wrapper class, the wrapper class should have two variables for your two columns. You can then put your data in to a list of this data type.

   public class ClassController {

     public List<DataWrapper> lTableData;

     // In the constructor for the ClassController
     // Populate the lTableData list (in a for loop )and then use that in 
        your data table
     // e.g. lTableData.add(new DataWrapper('Jan', 100)); etc

        public class DataWrapper{

           public String month;
           public Integer amount;

           public DataWrapper(String month, Integer amount){
               this.month = month;
               this.amount = amount;
       }
     }
   }

More info here: https://developer.salesforce.com/page/Wrapper_Class

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.