Date of birth checker

Creating and using forms

Date of birth checker

Postby Rakau » Tue Jul 05, 2016 11:24 am

I am trying to create a constraint on a date of birth field.
If a student was registering for a driver licence, and they must be (say) 16 years old, but entered a DOB that was short of the required 16 years,how can this be flagged to show not valid?
Thanks
LibreOffice 5.1.3.2 on Windows 8
Rakau
 
Posts: 1
Joined: Tue Jul 05, 2016 11:15 am

Re: Date of birth checker

Postby Sliderule » Tue Jul 05, 2016 4:18 pm

"Rakau wrote:I am trying to create a constraint on a date of birth field.
If a student was registering for a driver licence, and they must be (say) 16 years old, but entered a DOB that was short of the required 16 years,how can this be flagged to show not valid?

Yes. The answer in the post below ( look at the posts by both Sliderule and Villeroy ) , assumes with your use of LibreOffice Base as your database back-end, and, HSQL Embedded Database as your database back-end, that is HSQL 1.8.0.10 ( you can confirm this be looking that the Status Bar at the bottom after starting your Base File ( *.odb ) ).

https://forum.openoffice.org/en/forum/viewtopic.php?f=13&t=36069&p=165388

Explanation:
  1. By performing the calculation as noted in the link above, you can determine the AGE in years. This calculation can be also be used, for example:
    1. Code: Select all   Expand viewCollapse view
      CASEWHEN(calculation >= 16,'Valid','Not Valid') as "Age_At_Least_16"


    2. Code: Select all   Expand viewCollapse view
      CASE WHEN calculation >= 16 THEN 'Valid' Else 'Not Valid' End as "Age_At_Least_16"
  2. If you are using HSQL 2.X, or, another database back-end, let us know, since that SQL calculation might be different. :crazy:

I hope this helps, please be sure to let me / us know. :super:

Sliderule
User avatar
Sliderule
Volunteer
 
Posts: 1242
Joined: Thu Nov 29, 2007 9:46 am


Return to Forms

Who is online

Users browsing this forum: No registered users and 3 guests