dbTalk Databases Forums  

Checking to see if a value exists

comp.databases.filemaker comp.databases.filemaker


Discuss Checking to see if a value exists in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Thomas Hansen
 
Posts: n/a

Default Checking to see if a value exists - 11-02-2005 , 02:34 AM






Is it possible to check if a field contains a certain value in any of
the records in my database?

A script in my database is assigning an email address to each new user,
and I would like to be able to check if the field EMAIL (ie.) contains
that address for any of the other records in my database, so as to avoid
duplicates.

Essentially, what I'm looking for is a Perform Find function that
returns the number of records found - and does not display an error
message if that number is zero. What I've done so far is to check each
record with a loop and Get Next Record/Request, but that takes time when
the number of records grow.

--
Thomas Hansen : th(at)ambolt.no : http://www.ambolt.no/

Reply With Quote
  #2  
Old   
Remi-Noel Menegaux
 
Posts: n/a

Default Re: Checking to see if a value exists - 11-02-2005 , 03:31 AM






You may try :

Enter Browse mode
Set Field(GlobalField, SearchedValue)
Set Error Capture (on)
Enter Find mode
Set Field( AddressField, GlobalField)
Perform Find (Replace Found Set)
If( Status ( CurrentError ) = 401)
Set Error Capture (off)
Show All Records
End script
End If
Set Error Capture (off)
Set Field(GlobalField, Status ( CurrentFoundCount ))
Show Message( "In the "GlobalField" you have the number of duplicates")

Remi-Noel


"Thomas Hansen" <violon (AT) online (DOT) no> a écrit dans le message de news:
violon-3C3F5E.09341502112005 (AT) sunsite (DOT) dk...
Quote:
Is it possible to check if a field contains a certain value in any of
the records in my database?

A script in my database is assigning an email address to each new
user,
and I would like to be able to check if the field EMAIL (ie.) contains
that address for any of the other records in my database, so as to
avoid
duplicates.

Essentially, what I'm looking for is a Perform Find function that
returns the number of records found - and does not display an error
message if that number is zero. What I've done so far is to check each
record with a loop and Get Next Record/Request, but that takes time
when
the number of records grow.

--
Thomas Hansen : th(at)ambolt.no : http://www.ambolt.no/



Reply With Quote
  #3  
Old   
Thomas Hansen
 
Posts: n/a

Default Re: Checking to see if a value exists - 11-02-2005 , 09:37 AM



Thanks - that does seem like it would solve my problem.

--
Thomas Hansen : th(at)ambolt.no : http://www.ambolt.no/

Reply With Quote
  #4  
Old   
Brent Lewis
 
Posts: n/a

Default Re: Checking to see if a value exists - 11-02-2005 , 04:16 PM



You could also place the value in a global field and test a relationship
between that value and the appropriate table to see if it already exists.
This would not require a find, so your current found set would be preserved.
As the number of records increases, it should also be faster.
--
Brent Lewis
Interactive Systems, Inc.
Associate Member, FileMaker Solutions Alliance
http://www.InteractiveSystemsInc.com

"Thomas Hansen" <violon (AT) online (DOT) no> wrote

Quote:
Thanks - that does seem like it would solve my problem.

--
Thomas Hansen : th(at)ambolt.no : http://www.ambolt.no/



Reply With Quote
  #5  
Old   
Jens Rasmussen
 
Posts: n/a

Default Re: Checking to see if a value exists - 11-08-2005 , 07:39 PM



How about Field options - validation - unique?
Is that too obvious?

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.