I wanna create pageBlock column based on the date range. e.g if I select the range 1-1-2015 to 12-5-2015, dynamically column should create based on the date value.

1-1-2015 | 2-1-2015 | 3-1-2015 | 4-1-2015

Let me know if you know this.

  • Please post your current code as an example so that we can better understand what it is you are trying to accomplish. Currently, it is unclear what you mean. Are you trying to create additional columns in an apex:pageBlockTable? Where does the input date range come from (input boxes or perhaps a select list)? Commented Jul 22, 2015 at 18:08
  • I just put the Start Date : <input type="date" /> <br/><br/><br/> End Date : <input type="date" />
    – Alex
    Commented Jul 22, 2015 at 18:09
  • I dont know how to load the apex repeat based on the selected range
    – Alex
    Commented Jul 22, 2015 at 18:10
  • please post your VF markup so I can gather the proper context :) Commented Jul 22, 2015 at 18:12
  • Right now, my best guess is that you have two input boxes to select the date range, and then you want to dynamically display columns in a table, with one column representing each month within the chosen range. Is that correct? Commented Jul 22, 2015 at 18:18

1 Answer 1


Your apex:repeat should loop over a list built as the result of a function call. So if you have your range inputs bound to the controller, your VF should resemble

<apex:repeat value="{!generateRange}" var="date" >....

and your controller should a method similar to the following:

public List<String> generateRange(){
    String[] ret = new List<String>();
    Date tmp = startDate; //<-- where startDate is the input from page
    while(tmp.addMonths(1) < endDate){ //<-- endDate being the other input from page
    return ret;

You must log in to answer this question.

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