1 Reply Latest reply on Jan 1, 2010 1:00 AM by comment_1

    date calculations

    Jbmcglade

      Title

      date calculations

      Post

      A calculated filed called program date (a date field) is set to caculate based on the following;

       

      I have a check box that has Yes or no as the possible choices.  A calculation for dates is written as follows:

       

      If(pre_nights = "yes"; departue date - pre-nights; departure date)

       

      Pre_nights is a number field

      Departure date is a date field

      calcualtion is for a filed called program date

       

      The field does not calculate. If the check box is "no" the field remains blank; if the check box is "yes" the field gives the departure date without the subtraction of the pre-nights.

       

      Finally is there a way to force a record to re-calculate?

       

      I would appreciate any ides on this.

       

       

      Thanks,

       

      John 

        • 1. Re: date calculations
          comment_1
            

          Jbmcglade wrote:

          If(pre_nights = "yes"; departue date - pre-nights; departure date)

           

          Pre_nights is a number field


          It doesn't fit together:

           

          First, "yes" is not a number - so if you expect pre_nights to contain "yes", make it a text field (or - preferably - use 1 for True, 0 or empty for False).

           

          Next, subtracting "yes" from a date does nothing. I am assuming that pre_nights  and pre-nights are the same field and that the difference is a typo - otherwise, pre-nights is not a valid field name.

           

           

          Finally, it is not clear if the field program date is a Calculation field or a Date field with auto-entered calculated value - I'd suggest you make it a Calculation field with the result set to type Date.

           

           

           

          ---

          ADDED:

          Perhaps you meant to subtract pre_nights from departure date only if pre_nights contain a value? If so, then =

           

          departure date - pre_nights

           

          should be quite sufficient.