1 Reply Latest reply on Jul 24, 2010 4:34 PM by LaRetta_1

    Date Calculation



      Date Calculation



      Iam trying to do date calculations. I have a database where an "In" and an "Out" date are entered into two their respective fields. Sometimes people enter the incorrect out date and I want the out date to not be less than or before the in date. I've tried logical functions Case;result and If;then and neither seems to work.

      Any suggestions for having a field not have the date entered before another date.

      thanks in advance

        • 1. Re: Date Calculation

          What do you want to do if the User makes a mistake and enters an OUT date which is earlier than the IN date?  What are your business rules?  Three ways I'll cover:

          1) If you want the User to be stopped and forced to correct their entry, use the field Options (validation tab) and enter something like this:

          OutDate >= InDate

          This will produce 1 (or boolean true) meaning it passes validation. You can include a message and force them to correct it.

          2) You could also just correct their entry:

          Options (auto-enter tab) by calculation (result is date):

          Case ( OutDate < InDate ; InDate ; Self )

          ... and back at the Auto-Enter tab when you leave the calculation and uncheck 'do not replace existing value if any' checkbox.  Or if the default is that the OUT should always be one year later than the In, then you can produce those results as well.

          3) If you have script trigger, you can handle the validation yourself (upon field exit) and produce a custom message or offer the User options in correcting it (which is usually nicer than field-level validation).