Normal Topic Unique values (Read 533 times)
Axel
Member
*
Offline



Posts: 2
Joined: Oct 1st, 2009
Unique values
Oct 20th, 2009 at 1:24pm
Print Post Print Post  
I am relatively new to Sesame. Hence I beg pardon if my topic is stupid. Sesame works too "strictly" when it comes to unique fields.
I am running a historical database in coherence with my job as a journalist.
This is a rather large database (more than 15.000 records), it contains (amongst others) two elements which I would like to be (almost) unique, a date-field and a name/event field.
Now, if the database contains already a certain date I would like to be warned in case I try to enter the very same date.

But Sesame should nevertheless allow me to enter that date. This is very useful if it happens that two or even more events happened on the same date and I do not know whether or not the events have already been entered. This might easily happen at a database with more than 15.000 records.
I then can check (F7) and possibly enter the record.
Q&A was very cooperative in this respect. I got the warning but was still able to enter the same date.
If  I define in Sesame a field as unique I am warned but the programme refuses to accept the entry.
I have studied the manuals and found that there is a command
@IsUnique (LE, key).
I not sure, but can this command assist?I have abolutely no programming experience in Sesame but the programming in Q&A is familar to me.

Regards 
Axel Voss
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Unique values
Reply #1 - Oct 20th, 2009 at 2:38pm
Print Post Print Post  
Hello Axel,

You can use @IsUnique() along with @MsgBox to bring up a message warning that the current value may not be unique and still allow you to save the record.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Unique values
Reply #2 - Oct 21st, 2009 at 12:34pm
Print Post Print Post  
Hi Axel,

I almost never set a field to "Unique" using the Read Only property, for the same reason you describe. I find the best solution is as Ray described.

Since "a picture is worth a thousand words", here is an actual bit of code that I use in the "On Element Change" event of the System ID element.

Code
Select All
If @IsUnique(System ID, System ID) = 0
	@MsgBox("System ID is not unique. Please correct it.", "", "")
 

  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged