2 Replies Latest reply on Feb 14, 2012 3:38 AM by johnrojo

    Increment dates

    johnrojo Level 1

      Working on a form that's sort of a timesheet.  How would I fill in other fields based on an initial date ??  IE: Field-A, a date/time field gets filled in.  I'd then like to automatically fill in another 13 fields for the time period with dates based off Field-A. In advance - many thanks.

        • 1. Re: Increment dates
          $Nith$ Level 4

          Presume that your Date field has the value pattern as DD/MM/YYYY

           

          You can convert it's rawvalue into number of days using the following script in FormCalc

           

          var firstDate = Date2Num(DateField1.rawValue,"DD/MM/YYYY")

           

          now firstDate will have the number of days since epoch.

           

          Next step you can add 1 to the firstDate and convert it back into Date Object using the following syntax

           

          secondDateField.rawValue =  Num2Date(firstDate,"DD/MM/YYYY")

           

          Similarly you can do it for all 13 date fields.

           

          Nith

          • 2. Re: Increment dates
            johnrojo Level 1

            Sweet.

             

            Thank you.

             

            John Rojowski

            DFAS/IND DJMS-AC SIT

            Phone:  317-212-7470

             

            "Simplify."