OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Data Validation - set range

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base
View previous topic :: View next topic  
Author Message
amarumayo
Newbie
Newbie


Joined: 02 Jul 2012
Posts: 3

PostPosted: Mon Jul 02, 2012 6:46 am    Post subject: Data Validation - set range Reply with quote

I am trying to limit the range on a numeric import on a form. I.e. if the user enters 155 when the range is set from 50-150 it will return and error so that I can minimize data entry mistakes. I understand that this may need a SQL command. Any ideas?
Thanks
Back to top
View user's profile Send private message Send e-mail
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Mon Jul 02, 2012 8:10 am    Post subject: Reply with quote

On form level you can do this with a numeric control which allows you to specify an minimum and a maximum (a "formatted control" I think).

Below form level (e.g. table/query/update) you can still enter arbitrary numbers within the range of the data type.
Try this one in Tools>SQL:
ALTER TABLE "YOUR_TABLE" ADD CONSTRAINT "Range_Limit" CHECK "YOUR_FIELD" BETWEEN 50 AND 150

You can remove the constraint like this:
ALTER TABLE "YOUR_TABLE" DROP CONSTRAINT "Range_Limit"

In HSQLDB such a constraint is limited to the field values of one row. It can not do any comparison between other rows nor tables.
This is another variant comparing 2 fields:
ALTER TABLE "YOUR_TABLE" ADD CONSTRAINT "Range_Limit" CHECK "From_Time" <= "Until_Time"
_________________
Rest in peace, oooforum.org
Get help on https://forum.openoffice.org
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group