Finding records not equal to an integer

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Finding records not equal to an integer

Postby drookwood » Wed Jan 14, 2004 6:18 pm

As far as I can work out using the ! to perform an omit find (i.e. entering !Jones to locate all records where the name is not Jones) only works for text fields.

Is there an equivalent for integer fields - I want to find all records where an ID code is not a specific value.
drookwood
 
Posts: 290
Joined: Tue Nov 11, 2003 7:08 pm
Location: Somerset, UK

Postby IT2Be » Wed Jan 14, 2004 7:45 pm

Don't know but I tested it in the GUI after a find declaration but it works on numbers too...
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby maarten » Wed Jan 14, 2004 9:11 pm

You probably mean in scripting:
(Ctrl+F does work)

controller.find()
companiesid != 3005 (or > <)
controller.search()

Doesn't seem to work.
I'll pass this to dev team.
Maarten Berkenbosch
User avatar
maarten
 
Posts: 797
Joined: Wed Apr 23, 2003 10:52 pm
Location: Amersfoort, Netherlands

Postby jcompagner » Wed Jan 14, 2004 10:01 pm

in scripting if you want > or ! you have to set them as strings!

so

companiesid = '!3005'

or

companiesid = '>3005'
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Postby maarten » Wed Jan 14, 2004 11:04 pm

thanks Johan :oops:
Maarten Berkenbosch
User avatar
maarten
 
Posts: 797
Joined: Wed Apr 23, 2003 10:52 pm
Location: Amersfoort, Netherlands

Postby drookwood » Thu Jan 15, 2004 1:13 pm

A point to note here is that records with empty values will not be found when using ! to locate records not equal to a specified value.

Given 6 records:

Record 1, field 1 = 1
Record 2, field 1 = 0
Record 3, field 1 = (empty)
Record 4, field 1 = 0
Record 5, field 1 = 1
Record 6, field 1 = 1

performing a Find for records where field 1 = !1 will not include record 3 in the found set, only records 2 and 4.
drookwood
 
Posts: 290
Joined: Tue Nov 11, 2003 7:08 pm
Location: Somerset, UK

Postby jcompagner » Thu Jan 15, 2004 1:46 pm

This is right because null/void is not a value so can't be selected with a = XXX where statementent.

if you also want to select null values then you have to set it als equale to ^

so

controller.find()
field = '!1'
controller.newRecord();
field = '^'
controller.search();
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 8 guests

cron