Solved

# Lotus Formula: Simple question on date Validation

Posted on 2007-08-10
916 Views
Hi

I have to date fields which use the calendar time control, one is a Job In the other a Job Due Date, how do I set a field validation formula that prompts a user if he tries to enter an earlier date  in the Due Date field?

Many thanks
0
Question by:captain

LVL 22

Accepted Solution

From the Designer Help:

"Dates can be compared and subtracted. Subtraction yields a numeric value representing seconds. To measure the difference between two dates in days, divide the result by 86,400, which is the number of seconds in a day."

So, your validation formula for the "JobDueDate" field might look something like this:

@If(
!@IsDocBeingSaved;
@Success;

@Date(JobDueDate) - @Date(JobIn) < 0;
@Failure("Job Due Date cannot be before Job In date.");

@Success)
0

LVL 32

Author Comment

Hi Bill

Get the error "Incorrect data type for operator or @function", which is similar to what I tried using simple formula calcs earlier, do you think this is due to time control rather than using notes style.

Also this validation only runs on save I want this to run on input.

up with the points
0

LVL 32

Author Comment

Hi Bill

oooooppppssss, typo in my field name, humble apologies.

Removed the first argument: so my formula is now:
@If(@Date(D_REQ) - @Date(D_IN) < 0;
@Failure("Due Date cannot be before Job In date.");
@Success)

All hunky dory

Thanks
0

LVL 32

Author Comment

Clarify to not get Time/Date expected error:

@If(D_REQ="";@Success;
@Date(D_REQ) - @Date(D_IN) < 0;
@Failure("Due Date cannot be before Job In date.");

@Success
0

LVL 31

Expert Comment

This also works,  a little simpler:
@If(D_REQ="";@Success;
@Date(D_REQ) < @Date(D_IN);
@Failure("Due Date cannot be before Job In date.");
@Success)

And this is even simpler:
@IfError(
@If(D_REQ < D_IN; "Due Date cannot be before Job In date."; @Success);
@Success)
0

LVL 32

Author Comment

Thanks qwaletee, this is good help for me to understand and learn about formula language.

I am sure be back with q's soon, watch my posts

All the best
0

## Featured Post

### Suggested Solutions

Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…