locked
How to populate dropdown with dates that are in a given Date span RRS feed

  • Question

  • Hi,

    I have two date picker controls. I have a dropdown in which i need to populate the dates that are lying inside the date span that is created by date picker controls. for example, "3/16/2011" and "3/20/2011" are selected from the date pickers, now i need  "3/16/2011" "3/17/2011" "3/18/2011" "3/19/2011" and "3/20/2011" as dropdown list items. How it can be done ?? How it can be done in infopath ?

    Thanks.

    • Edited by Ovais Ashraf Wednesday, March 16, 2011 6:52 AM another question
    Wednesday, March 16, 2011 6:51 AM

Answers

  • I have develop a List (ListA) having Cloumns "DateStart", "DateEnd" and "Textfield". I have made another List (ListB) which also have the same columns as ListA have. Two List Workflows have been associated with ListA namely Acreated and Amodified. ListB has one workflow Bcreated. The functionality of these workflows are:

    - Acreated will create item in ListB with Copying Dates to corresponding date fields in ListB and the ID of the ListA item would be copied to "TextField" of ListB.

    - Bcreated will compare its Item's Dates whether DateStart is less than DateEnd, if yes then update the ListA Item (remember the ID saved in TextField) by saving ListB item's ID to ListA Textfield.

    - Amodified will first get the DateStart from ListB item (in worflow variable) whose ID has been set in Textfield of ListA by Bcreated. Then add a day to it and then create Item in ListB with DateStart = workflow variable.

    Its quite obvious that it will make a loop i.e, Whenever ListA item is created, ListB item is created which updates the ListA item which in turn create another item in ListB which updates the ListA item and this process will continue until Bcreated comparision would become false.

    Now you can bind the dropdown with ListB so that you could have dates in it.

    Thanks.
    Monday, March 21, 2011 6:24 AM

All replies

  • Hi,

    There is no build-in way to do this in InfoPath, you should bind the dropdown list programmatically.

    There has an article can help you to get started: http://www.bizsupportonline.net/infopath2007/programmatically-fill-populate-drop-down-list-box-infopath-2007.htm  

     


    Xue-Mei Chang
    Friday, March 18, 2011 3:23 AM
  • Thanks for your reply. I resolve this issue by doing it using lists and workflows. I will share my stuff on my blog very soon (need couple of days).
    Friday, March 18, 2011 11:59 AM
  • Hello Ovais, Can you post what you concluded here so other users with same problem can see the answer to the question you posted? Thanks


    Mohamed Derhalli ||| SharePoint Specialist ||| http://Path2SharePoint.com
    Saturday, March 19, 2011 7:54 PM
  • I have develop a List (ListA) having Cloumns "DateStart", "DateEnd" and "Textfield". I have made another List (ListB) which also have the same columns as ListA have. Two List Workflows have been associated with ListA namely Acreated and Amodified. ListB has one workflow Bcreated. The functionality of these workflows are:

    - Acreated will create item in ListB with Copying Dates to corresponding date fields in ListB and the ID of the ListA item would be copied to "TextField" of ListB.

    - Bcreated will compare its Item's Dates whether DateStart is less than DateEnd, if yes then update the ListA Item (remember the ID saved in TextField) by saving ListB item's ID to ListA Textfield.

    - Amodified will first get the DateStart from ListB item (in worflow variable) whose ID has been set in Textfield of ListA by Bcreated. Then add a day to it and then create Item in ListB with DateStart = workflow variable.

    Its quite obvious that it will make a loop i.e, Whenever ListA item is created, ListB item is created which updates the ListA item which in turn create another item in ListB which updates the ListA item and this process will continue until Bcreated comparision would become false.

    Now you can bind the dropdown with ListB so that you could have dates in it.

    Thanks.
    Monday, March 21, 2011 6:24 AM