1 Reply Latest reply on Jul 21, 2009 10:13 PM by Ben Walsh

    Automatically adding dates in date range

    Loretta R.

       

      Is it possible to enter a start date and end date in a form and then have a line created for each day in the range with the date included? I've created a time sheet and would like one line per day in the date range entered.

        • 1. Re: Automatically adding dates in date range
          Ben Walsh Level 2

          Yes - this is very possible.

           

          To make it work, you have to:

           

          1. Set up your timesheet entries as fields within a repeating subform

          2. Decide when you want the timesheet entries to update e.g. on the click of a button or as the user enters a new date

          3. Write code on the appropriate event to calculate the number of days between the dates and set the number of instances of the repeating subform

           

          Please see the example form attached.

           

          Notes:

          - I used FormCalc as this makes it easier to manipulate dates. Typically, I would use JavaScript, but date manipulation is one of the rare occassions when formCalc is by far the better choice

          - I used a floating field in the timesheet subform to demonstrate how you would display the date in each row

          - The attached form is an example only. Additional work is required to make this robust e.g. handling the case when the to date is prior to the from date

           

          Ben Walsh
          www.avoka.com