pietschker Posted January 27, 2005 Posted January 27, 2005 All, I'm puzzled about how to validate a date field, i.e. to check for impossible or incomplete dates. In FP6 I could do this with the "isvalid" calculation. FP7 seems to be more tolerant. I have 3 numeric fields, Day_n, Month_n and Year_n, and I want to check whether the resulting date is valid. Of course, things like 1/0/2005 or 2/29/2005 should be invalid. FP7 just returns 12/31/2004 in the first case, 3/1/2005 in the second when I use Date_d = Date(Month_n;Day_n;Year_n). Consequently, IsValid (Date_d) always returns 1. Any ideas how to do a *real* check? Thanks for any ideas! Lutz
-Queue- Posted January 27, 2005 Posted January 27, 2005 How about something like Let( D1 = Date( Month_n; Day_n; Year_n ); Month(D1) = Month_n and Day(D1) = Day_n and Year(D1) = Year_n ) ?
DykstrL Posted January 27, 2005 Posted January 27, 2005 Why not use a real date field for the data entry, then change your other fields to calculations? Day_n = day(date_enter) Month_n = Month(date_enter) Year_n = Year(date_enter) That way the date enter field would automatically validate a valid date. ...just a thought...
pietschker Posted January 28, 2005 Author Posted January 28, 2005 Queue, cute, this is something that works- actually, Day_n = Day( Date( Month_n; Day_n; Year_n) ) would be enough in my case, since the day can be -1/+3 days off, at most, within the scope of my problem. Thanks! And still I am puzzled about FP7's lack of a corresponding function... DykstrL, the problem is that I have the day, month and year numbers to begin with- it is in the naming convention of scans I want to import into the database. The problem is that the scan names are not tamper-proof, so I just want to make sure that the date extracted from the name evaluates to a valid date. Thanks for giving me your thoughts on this! Lutz
Recommended Posts
This topic is 7308 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now