Home > Domino Tips > Developer > Formula > Prevent users from saving multiple documents with same key data
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

FORMULA

Prevent users from saving multiple documents with same key data


Tandy Wine
03.15.2005
Rating: -4.00- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


View member feedback to this tip.

This tip shows you how to prevent users from saving more than one document with the same key data.

Based on one or two fields in a document, I wanted to make sure that the user does not try to create/save more than one document with the same information in these fields.

In this example, there are two fields, "Yr" and "DataSet", and the pair must be unique among documents. I put the following validation formula behind the "DataSet" field.

The view "(By Yr-Dataset)" contains @Text(Yr)+"-"+DataSet for the first column and @Text(@DocumentUniqueID) for the second column.

MEMBER FEEDBACK TO THIS TIP

The code in itself is not bad in that it will prevent users from duplicating reference keys, but my preference would be to calculate the key for the user rather than let them select it. I personally would not like it if I had to try several combinations before I could save my document which would be increasingly likely as the application contained more documents.

When I use reference keys I normally calculate based on the current date and time and turn this into a string. If you add to the front of this the users first initial and first letter of their surname then it is virtually impossible to get a duplicate key in two different documents.

—Andrew B.

******************************************

I see two problems with this way to ensure a unique identifier:

—Christophe R.

******************************************

Previous reviews of this tip may have missed the goal, or else I see another application where it is a good solution.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
Formula
View hidden fields on Lotus Notes/Domino forms
Case-insensitive @Unique version combines fields on Lotus Notes forms
Provide rich-text formatting via the Profile document and Formula
Using Formula language code to sort Lotus Notes messages by subject
How to create dynamic JavaScript in Notes Domino without formulas
Formula language button manages Deny Access list searches
Retrieve Lotus Notes names from a nested group using @DBLookup
Create a computed Lotus Notes field to list Personal Address Book names
Show multiple Lotus Notes document fields in a single view column
How to send a document as a link in a Lotus Notes email

Lotus Notes Domino Formula Language
View hidden fields on Lotus Notes/Domino forms
Case-insensitive @Unique version combines fields on Lotus Notes forms
Do I use Formula or LotusScript to include a doclink to a Notes view?
Top 10 Lotus Notes/Domino coding and development tips of 2008
Provide rich-text formatting via the Profile document and Formula
Top 10 Formula language tips
Using Formula language code to sort Lotus Notes messages by subject
How to create dynamic JavaScript in Notes Domino without formulas
Stop response documents from showing in a Lotus Notes form
Formula language button manages Deny Access list searches

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


This solution DOES apply when you have a class of objects with a property that should not be duplicated, or "overlap." Certainly a unique ID fits this description, but there are others. Say you have a resource that is rented out by the day, or you are scheduling patients for a certain doctor/room by the hour, half-hour, whatever. It's not so much that you want the patients or timeslots to be unique, but that you don't want them to overlap, and that is a solution domain not addressed by unique ID's, but certainly addressed by this solution.

Second, regarding unique identifiers, there are two easy ways to get them. @Right (@Unique; "-") gives you a 6-position alphanumeric ID. I prefer to trim off the first four letters and "-" returned by @Unique, which are only unique to a user. This is nice, quick, convenient, and is generally guaranteed to be unique, especially if they are generated on the server (by an agent or Web-based app). If you don't like that one and you are working in LotusScript or Java, you can create a NotesDocument object and steal its Universal ID. It doesn't get much more unique than that. One of the commentators is absolutely correct that you don't (generally) want your ID's to be chosen by or based on the input of users.

—Kent P.

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip exchange by member Tandy Wine. Please let others know how useful it is via the rating scale at the end of the tip. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts