Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.filemaker > #2149

Re: Validating an Input Date

From Helpful Harry <HelpfulHarry@BusyWorking.com>
Newsgroups comp.databases.filemaker
Subject Re: Validating an Input Date
Date 2015-04-12 13:54 +1200
Organization Aioe.org NNTP Server
Message-ID <120420151354408141%HelpfulHarry@BusyWorking.com> (permalink)
References <1m2p1sc.onwnbc6d6k1iN%csampson@inetworld.net> <mgbrk3$24s$3@news.motzarella.org> <1m2q64x.1udi6ww1arr87qN%csampson@inetworld.net>

Show all headers | View raw


In article <1m2q64x.1udi6ww1arr87qN%csampson@inetworld.net>, Charles H.
Sampson <csampson@inetworld.net> wrote:
> Howard Schlossberg <howard@nospam.fmprosolutions.com> wrote:
> > On 4/11/2015 3:12 AM, Charles H. Sampson wrote:
> > > 
> > > Is there any way in FMP (not advanced) to validate that a text string
> > > contains a correct date? Such things as only digits and slashes and
> > > values that are correct for month, day, and year?
> > 
> > How about:
> >       isValid( getAsDate( textEntered ) )
> > 
> > Or really, you don't need the isvalid() function.  Since converting an
> > invalid value to a date results in "?", you could just test for:
> >       getAsDate( textEntered ) <> "?"
> 
> Thanks, Howard. I forgot about IsValid lurking there among the logical
> functions. This is at least a gross check of the user input, allowing me
> to tell him that there's something wrong with his input.
> 
> If I want a more specific error indication, such as invalid month number
> or month/day mismatch, is it still up to me?

Yep. IsValid will only check if the date (or whatever) is valid, but
doesn't tell you why data is not valid.

If you want a more user-friendly error message, then you will have to
make your own check calculation. You could use IsValid to first check
for a problem, then only go on to the rest if there is an error.

Checking why the date is not valid could be a bit of a problem. You
would have to check that:

    - check there are only valid date characters, including if
      you want to allow textual month names (e.g. "15 Jan 1996")

    - the month is between 1 and 12 (which is easy, unless you want
      to take into account both mm/dd and dd/mm date entry)

    - the day is between 1 and 31, AND within the month's boundary,
      including Leap Days for February (which is more difficult)

    - possibly check the year is valid - whether that's because
      you want to insist on a four digit year or within a set
      period (e.g. 2000 onwards)

Helpful Harry  :o)

Back to comp.databases.filemaker | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Validating an Input Date csampson@inetworld.net (Charles H. Sampson) - 2015-04-11 03:12 -0700
  Re: Validating an Input Date clkaufmann@gmx.ch (Christoph Kaufmann) - 2015-04-11 13:51 +0200
    Re: Validating an Input Date csampson@inetworld.net (Charles H. Sampson) - 2015-04-11 17:43 -0700
      Re: Validating an Input Date Helpful Harry <HelpfulHarry@BusyWorking.com> - 2015-04-12 13:41 +1200
      Re: Validating an Input Date clkaufmann@gmx.ch (Christoph Kaufmann) - 2015-04-12 07:24 +0200
  Re: Validating an Input Date Howard Schlossberg <howard@nospam.fmprosolutions.com> - 2015-04-11 12:12 -0700
    Re: Validating an Input Date csampson@inetworld.net (Charles H. Sampson) - 2015-04-11 17:43 -0700
      Re: Validating an Input Date Helpful Harry <HelpfulHarry@BusyWorking.com> - 2015-04-12 13:54 +1200

csiph-web