Normal Topic Unique Field (Read 832 times)
PeterJohn
Member
*
Offline


No personal text

Posts: 1
Joined: Jan 13th, 2004
Unique Field
Jan 13th, 2004 at 4:56pm
Print Post Print Post  
In QA5 you could set up a field to accept only unique data e.g. in an invoicing file you would be warned if there was already an invoice number the same as the one you were about to enter. I've just started working with Sesame and can't find anything similar - Help !
  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Unique Field
Reply #1 - Jan 14th, 2004 at 2:47pm
Print Post Print Post  
I think your question is very important and relevant to everyone who will be working with Sesame. Since no one addressed to your question, I will try to give my two cents. Being amateur non-programmer user, my method is not likely to be simple and straight forward, hence I would also like to have a response  from a lantican.

Data integrity is a vital part to any database. One wants to make certain that there are no two duplicate records on the same person or invoice or referenceNo etc.  In Q&A there was index field and if you put "SU" in there, it will give you red flag everytime you enter (in Add mode) the value that has already been stored.  This was by no means very strict and if you hit one more <tab> or <enter> key, the flag will go away and you will end up adding duplicate record.  When you work with various employees and data entry people, it does not bode well for database intergrity and X group of commands will start getting the value from first available record. This was not good enough and I had to resort to small programming to avoid saving duplicate record.

In Sesame, there is no Indexing and there is no inbuilt validation for Unique field. However there is Notifyform( ) command that can stop saving the record on demand.

For sake of simplicity, let us say, you have two elements on the layout -

RecNumber:
Name:

RecNumber has to be uniuqe and the record has to have Name element filled up.  In validation put ! to indicate that it is a required data and if it is not having any value, record will not be saved.

Enter following programming in RecNumber, On Element Exit event

If @IsNew and @xlookup ( @filename, RecNumber, "RecNumber", "Name") <> "" then
     {
           @msgbox ("Record Exists","", "")
           Notifyform(1)
           goto RecNumber
     }

Similar little programming in Q&A also helped me avoid duplicate entries.


I hope, we will have some guidance and feedback from a lantican on this vital issue. It is my experience that a little direction or a note from Erika and Mark can save us tons of trouble.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Unique Field
Reply #2 - Jan 14th, 2004 at 3:18pm
Print Post Print Post  
Quote:
I hope, we will have some guidance and feedback from a lantican on this vital issue. It is my experience that a little direction or a note from Erika and Mark can save us tons of trouble.


Actually, this is meant to be a Forum where users can interact with and advise each other. We're being fairly active now, while the users get up to speed, and we will always keep an eye out for those who need developer level help. However, your advice is good and correct, so there's no real need for one of us to get involved.  Smiley 

All members of this Forum should feel free to help each other out. There's no need to wait for a Lantican to step in. As this product develops over time, it's likely that you'll know more cool tricks than we do!  Wink
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged